diff options
author | Stijn Buys <ingar@osirion.org> | 2012-02-18 14:37:21 +0000 |
---|---|---|
committer | Stijn Buys <ingar@osirion.org> | 2012-02-18 14:37:21 +0000 |
commit | 2d486c096ec890425ef0b23dcb6486e87ccf9788 (patch) | |
tree | fc7bb8d078700150392d1908f5e26fac168dfed2 | |
parent | 494d3951b8286695e41e8646016be9e7cd331012 (diff) |
Created basic Qt MDI area.
-rw-r--r-- | src/Makefile.am | 8 | ||||
-rw-r--r-- | src/editor.cc | 18 | ||||
-rw-r--r-- | src/mainwindow.cc | 35 | ||||
-rw-r--r-- | src/mainwindow.h | 38 |
4 files changed, 95 insertions, 4 deletions
diff --git a/src/Makefile.am b/src/Makefile.am index 5d98d2d..231fd8a 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -3,13 +3,15 @@ bin_PROGRAMS = editor # You have two .cpp files you wrote, editor.cpp and another.cpp # Remember to include the name of the resource file with the .cpp extension. editor_SOURCES = \ - editor.cc + editor.cc \ + mainwindow.cc # You have one .h file, it's called editor.h. Therefore, here I list # its mocced name, moc_editor.cpp. nodist_editor_SOURCES = \ - moc_editor.cc + moc_mainwindow.cc # This rule lets GNU make create any moc_*.cpp from the equivalent *.h moc_%.cc: %.h - moc $< -o $@
\ No newline at end of file + moc $< -o $@ +
\ No newline at end of file diff --git a/src/editor.cc b/src/editor.cc index 96fe0ea..28f75a7 100644 --- a/src/editor.cc +++ b/src/editor.cc @@ -1,4 +1,20 @@ +/* + editor.cc + This file is part of the Project::OSiRiON zone editor + and is distributed under the terms and conditions of + the GNU General Public License version 2 +*/ -int main(int arc, char ** argv) +#include <QApplication> +#include "mainwindow.h" + +int main(int argc, char ** argv) { + + QApplication editor_application(argc, argv); + editor::MainWindow editor_mainwindow; + + editor_mainwindow.show(); + return editor_application.exec(); + } diff --git a/src/mainwindow.cc b/src/mainwindow.cc new file mode 100644 index 0000000..22347a5 --- /dev/null +++ b/src/mainwindow.cc @@ -0,0 +1,35 @@ +/* + mainwindow.cc + This file is part of the Project::OSiRiON zone editor + and is distributed under the terms and conditions of + the GNU General Public License version 2 +*/ + +#include <mainwindow.h> + +namespace editor +{ + +MainWindow::MainWindow() +{ + // set window title + setWindowTitle(tr("Project::OSiRiON zone editor")); + + // initialize MDI (multiple document interface) area + mainwindow_mdiarea = new QMdiArea(); + mainwindow_mdiarea->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded); + mainwindow_mdiarea->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded); + setCentralWidget(mainwindow_mdiarea); + + // initialize menu bar + init_menu(); + +} + +void MainWindow::init_menu() +{ + mainwindow_filemenu = menuBar()->addMenu(tr("&File")); + mainwindow_editmenu = menuBar()->addMenu(tr("&Edit")); +} + +}
\ No newline at end of file diff --git a/src/mainwindow.h b/src/mainwindow.h new file mode 100644 index 0000000..702cc18 --- /dev/null +++ b/src/mainwindow.h @@ -0,0 +1,38 @@ +/* + mainwindow.h + This file is part of the Project::OSiRiON zone editor + and is distributed under the terms and conditions of + the GNU General Public License version 2 +*/ + +#ifndef __INCLUDED_EDITOR_MAINWINDOW__ +#define __INCLUDED_EDITOR_MAINWINDOW__ + +#include <QtGui> + +#include <QMainWindow> + +class QMenu; +class QMdiArea; + +namespace editor +{ + +class MainWindow : public QMainWindow +{ + Q_OBJECT + +public: + MainWindow(); + +private: + void init_menu(); + + QMdiArea *mainwindow_mdiarea; + QMenu *mainwindow_filemenu; + QMenu *mainwindow_editmenu; +}; + +} + +#endif // __INCLUDED_EDITOR_MAINWINDOW__
\ No newline at end of file |