00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #include "mainwindow.h"
00021
00022 MainWindow::MainWindow(QMainWindow *parent, Qt::WindowFlags flags)
00023 : QMainWindow(parent, flags)
00024 {
00025 setupUi();
00026
00027 createActions();
00028 createMenus();
00029 createStatusBar();
00030 }
00031
00032 MainWindow::~MainWindow()
00033 {
00034 }
00035
00036 void MainWindow::changeEvent(QEvent *event)
00037 {
00038 QMainWindow::changeEvent(event);
00039 switch (event->type()) {
00040 case QEvent::LanguageChange:
00041 retranslateUi();
00042 break;
00043 default:
00044 break;
00045 }
00046 }
00047
00048 void MainWindow::setupUi()
00049 {
00050 if (objectName().isEmpty())
00051 setObjectName(QString::fromUtf8("MainWindow"));
00052
00053 centralWidget = new QWidget(this);
00054 centralWidget->setObjectName(QString::fromUtf8("centralWidget"));
00055
00056 mainLayout = new QGridLayout(centralWidget);
00057 mainLayout->setObjectName(QString::fromUtf8("mainLayout"));
00058
00059 m_inputEventTextEdit = new InputEventTextEdit();
00060 m_inputEventTextEdit->setObjectName(QString::fromUtf8("textEdit"));
00061 m_inputEventTextEdit->setReadOnly(true);
00062
00063 mainLayout->addWidget(m_inputEventTextEdit, 0, 0);
00064 mainLayout->setRowStretch(0, 5);
00065 setLayout(mainLayout);
00066
00067 setCentralWidget(centralWidget);
00068
00069 menuBar = new QMenuBar(this);
00070 menuBar->setObjectName(QString::fromUtf8("menuBar"));
00071 menuBar->setGeometry(QRect(0, 0, 1290, 20));
00072 setMenuBar(menuBar);
00073
00074 statusBar = new QStatusBar(this);
00075 statusBar->setObjectName(QString::fromUtf8("statusBar"));
00076 setStatusBar(statusBar);
00077
00078 setWindowTitle("Gluon Tutorial 4");
00079 setWindowIcon(QIcon(":/images/icon.bmp"));
00080 setWindowIconText("Gluon Tutorial 4 application logo");
00081
00082 retranslateUi();
00083
00084 return;
00085 }
00086
00087 void MainWindow::retranslateUi()
00088 {
00089 setWindowTitle(QApplication::translate("mainwindow", "mainwindow", 0,
00090 QApplication::UnicodeUTF8));
00091 return;
00092 }
00093
00094 void MainWindow::createActions()
00095 {
00096
00097 quitAct = new QAction(QIcon(":/images/quit.png"), tr("&Quit"), this);
00098 quitAct->setShortcut(QKeySequence(Qt::CTRL + Qt::Key_Q));
00099 quitAct->setStatusTip(tr("Exit the application"));
00100 connect(quitAct, SIGNAL(triggered()), this, SLOT(close()));
00101
00102
00103 aboutAct = new QAction(tr("&About"), this);
00104 aboutAct->setStatusTip(tr("Show the Gluon Tutorial 4 Appplication About box"));
00105 connect(aboutAct, SIGNAL(triggered()), this, SLOT(mAbout()));
00106
00107 aboutQtAct = new QAction(tr("About &Qt"), this);
00108 aboutQtAct->setStatusTip(tr("Show the Qt library's About box"));
00109 connect(aboutQtAct, SIGNAL(triggered()), qApp, SLOT(aboutQt()));
00110 }
00111
00112 void MainWindow::createMenus()
00113 {
00114
00115 fileMenu = menuBar->addMenu(tr("&File"));
00116 fileMenu->addAction(quitAct);
00117
00118 menuBar->addSeparator();
00119
00120
00121 helpMenu = menuBar->addMenu(tr("&Help"));
00122 helpMenu->addAction(aboutAct);
00123 helpMenu->addAction(aboutQtAct);
00124 }
00125
00126 void MainWindow::createStatusBar()
00127 {
00128 statusBar->showMessage(tr("Ready"));
00129 }
00130
00131 void MainWindow::mAbout()
00132 {
00133 QMessageBox::about(this, tr("<b>Gluon Tutorial 4a application</b>"), \
00134 tr("This is a trial application showing the capability "
00135 "of the\n Gluon input subsystem."));
00136 }
00137
00138 InputEventTextEdit *MainWindow::inputEventTextEdit()
00139 {
00140 return m_inputEventTextEdit;
00141 }
00142
00143 void MainWindow::closeEvent(QCloseEvent *event)
00144 {
00145 QApplication::instance()->exit(0);
00146 }
00147
00148 #include "mainwindow.moc"