Commit d9772752 by Kai Westerkamp

MAnu and ToolBar

parent 005b6880
...@@ -11,7 +11,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets ...@@ -11,7 +11,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = hellocube TARGET = hellocube
TEMPLATE = app TEMPLATE = app
SOURCES += main.cpp\ SOURCES += main.cpp\
mainwindow.cpp mainwindow.cpp
......
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE QtCreatorProject> <!DOCTYPE QtCreatorProject>
<!-- Written by QtCreator 3.5.1, 2015-10-20T22:00:43. --> <!-- Written by QtCreator 3.5.1, 2015-10-21T15:50:15. -->
<qtcreator> <qtcreator>
<data> <data>
<variable>EnvironmentId</variable> <variable>EnvironmentId</variable>
...@@ -413,7 +413,7 @@ ...@@ -413,7 +413,7 @@
<value type="int">13</value> <value type="int">13</value>
<value type="int">14</value> <value type="int">14</value>
</valuelist> </valuelist>
<value type="int" key="PE.EnvironmentAspect.Base">-1</value> <value type="int" key="PE.EnvironmentAspect.Base">2</value>
<valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/> <valuelist type="QVariantList" key="PE.EnvironmentAspect.Changes"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value> <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value> <value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
......
...@@ -9,43 +9,51 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -9,43 +9,51 @@ MainWindow::MainWindow(QWidget *parent)
setWindowTitle("Hello Cube"); setWindowTitle("Hello Cube");
menuBar = new QMenuBar(); menuBar = new QMenuBar();
toolBar = new QToolBar("Shading",this);
statusBar = new QStatusBar(this);
//File Menu Actions
fileMenu = new QMenu("&File"); fileMenu = new QMenu("&File");
shadingMenu= new QMenu("Shading"); shadingMenu= new QMenu("Shading");
shadingGroup = new QActionGroup(shadingMenu);
//Shader Menu Actions
exitAction = new QAction("E&xit",fileMenu); exitAction = new QAction("E&xit",fileMenu);
exitAction->setShortcut(QKeySequence::Quit); exitAction->setShortcut(QKeySequence::Quit);
connect(exitAction, SIGNAL(triggered()), this, SLOT(close())); connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
shadingGroup = new QActionGroup(fileMenu);
noneAction = new QAction("None",shadingMenu); noneAction = new QAction("None",shadingMenu);
noneAction->setShortcut(QKeySequence("Ctrl+1")); noneAction->setShortcut(QKeySequence("Ctrl+1"));
noneAction->setCheckable(true); noneAction->setCheckable(true);
shadingGroup->addAction(noneAction);
noneAction->setIcon(QIcon(":/img/wireframe.png")); noneAction->setIcon(QIcon(":/img/wireframe.png"));
shadingGroup->addAction(noneAction);
flatAction = new QAction("Flat",shadingMenu); flatAction = new QAction("Flat",shadingMenu);
flatAction->setShortcut(QKeySequence("Ctrl+2")); flatAction->setShortcut(QKeySequence("Ctrl+2"));
flatAction->setCheckable(true); flatAction->setCheckable(true);
flatAction->setChecked(true); flatAction->setChecked(true);
shadingGroup->addAction(flatAction);
flatAction->setIcon(QIcon(":/img/flat.png")); flatAction->setIcon(QIcon(":/img/flat.png"));
shadingGroup->addAction(flatAction);
gouraudAction = new QAction("Gouraud",shadingMenu); gouraudAction = new QAction("Gouraud",shadingMenu);
gouraudAction->setShortcut(QKeySequence("Ctrl+3")); gouraudAction->setShortcut(QKeySequence("Ctrl+3"));
gouraudAction->setCheckable(true); gouraudAction->setCheckable(true);
shadingGroup->addAction(gouraudAction);
gouraudAction->setIcon(QIcon(":/img/gouraud.png")); gouraudAction->setIcon(QIcon(":/img/gouraud.png"));
shadingGroup->addAction(gouraudAction);
phongAction = new QAction("Phong",shadingMenu); phongAction = new QAction("Phong",shadingMenu);
phongAction->setShortcut(QKeySequence("Ctrl+4" )); phongAction->setShortcut(QKeySequence("Ctrl+4" ));
phongAction->setCheckable(true); phongAction->setCheckable(true);
shadingGroup->addAction(phongAction);
phongAction->setIcon(QIcon(":/img/phong.png")); phongAction->setIcon(QIcon(":/img/phong.png"));
shadingGroup->addAction(phongAction);
//Other Actions
aboutAction = new QAction("About",menuBar);
connect(aboutAction,SIGNAL(triggered()),this,SLOT(showAboutBox()));
camHome = new QAction(QIcon(":/img/cam_home.png"),"Cam Home", toolBar);
// Assemble Menus
fileMenu->addAction(exitAction); fileMenu->addAction(exitAction);
menuBar->addMenu(fileMenu); menuBar->addMenu(fileMenu);
...@@ -55,13 +63,22 @@ MainWindow::MainWindow(QWidget *parent) ...@@ -55,13 +63,22 @@ MainWindow::MainWindow(QWidget *parent)
shadingMenu->addAction(phongAction); shadingMenu->addAction(phongAction);
menuBar->addMenu(shadingMenu); menuBar->addMenu(shadingMenu);
aboutAction = new QAction("About",menuBar);
connect(aboutAction,SIGNAL(triggered()),this,SLOT(showAboutBox()));
menuBar->addAction(aboutAction); menuBar->addAction(aboutAction);
setMenuBar(menuBar); setMenuBar(menuBar);
//Assemble Tool Bar
toolBar->addAction(noneAction);
toolBar->addAction(flatAction);
toolBar->addAction(gouraudAction);
toolBar->addAction(phongAction);
toolBar->addAction(camHome);
addToolBar( toolBar);
statusBar->showMessage("Hello");
setStatusBar(statusBar);
} }
MainWindow::~MainWindow() MainWindow::~MainWindow()
......
...@@ -8,6 +8,8 @@ ...@@ -8,6 +8,8 @@
#include <QActionGroup> #include <QActionGroup>
#include <QIcon> #include <QIcon>
#include <QMessageBox> #include <QMessageBox>
#include <QToolBar>
#include <QStatusBar>
class MainWindow : public QMainWindow class MainWindow : public QMainWindow
...@@ -29,6 +31,11 @@ private: ...@@ -29,6 +31,11 @@ private:
QAction *aboutAction; QAction *aboutAction;
QAction *camHome;
QToolBar *toolBar;
QStatusBar *statusBar;
public: public:
MainWindow(QWidget *parent = 0); MainWindow(QWidget *parent = 0);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment