Commit d9772752 by Kai Westerkamp

MAnu and ToolBar

parent 005b6880
......@@ -11,7 +11,6 @@ greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
TARGET = hellocube
TEMPLATE = app
SOURCES += main.cpp\
mainwindow.cpp
......
<?xml version="1.0" encoding="UTF-8"?>
<!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>
<data>
<variable>EnvironmentId</variable>
......@@ -413,7 +413,7 @@
<value type="int">13</value>
<value type="int">14</value>
</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"/>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Arguments"></value>
<value type="QString" key="ProjectExplorer.CustomExecutableRunConfiguration.Executable"></value>
......
......@@ -9,43 +9,51 @@ MainWindow::MainWindow(QWidget *parent)
setWindowTitle("Hello Cube");
menuBar = new QMenuBar();
toolBar = new QToolBar("Shading",this);
statusBar = new QStatusBar(this);
//File Menu Actions
fileMenu = new QMenu("&File");
shadingMenu= new QMenu("Shading");
shadingGroup = new QActionGroup(shadingMenu);
//Shader Menu Actions
exitAction = new QAction("E&xit",fileMenu);
exitAction->setShortcut(QKeySequence::Quit);
connect(exitAction, SIGNAL(triggered()), this, SLOT(close()));
shadingGroup = new QActionGroup(fileMenu);
noneAction = new QAction("None",shadingMenu);
noneAction->setShortcut(QKeySequence("Ctrl+1"));
noneAction->setCheckable(true);
shadingGroup->addAction(noneAction);
noneAction->setIcon(QIcon(":/img/wireframe.png"));
shadingGroup->addAction(noneAction);
flatAction = new QAction("Flat",shadingMenu);
flatAction->setShortcut(QKeySequence("Ctrl+2"));
flatAction->setCheckable(true);
flatAction->setChecked(true);
shadingGroup->addAction(flatAction);
flatAction->setIcon(QIcon(":/img/flat.png"));
shadingGroup->addAction(flatAction);
gouraudAction = new QAction("Gouraud",shadingMenu);
gouraudAction->setShortcut(QKeySequence("Ctrl+3"));
gouraudAction->setCheckable(true);
shadingGroup->addAction(gouraudAction);
gouraudAction->setIcon(QIcon(":/img/gouraud.png"));
shadingGroup->addAction(gouraudAction);
phongAction = new QAction("Phong",shadingMenu);
phongAction->setShortcut(QKeySequence("Ctrl+4" ));
phongAction->setCheckable(true);
shadingGroup->addAction(phongAction);
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);
menuBar->addMenu(fileMenu);
......@@ -55,13 +63,22 @@ MainWindow::MainWindow(QWidget *parent)
shadingMenu->addAction(phongAction);
menuBar->addMenu(shadingMenu);
aboutAction = new QAction("About",menuBar);
connect(aboutAction,SIGNAL(triggered()),this,SLOT(showAboutBox()));
menuBar->addAction(aboutAction);
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()
......
......@@ -8,6 +8,8 @@
#include <QActionGroup>
#include <QIcon>
#include <QMessageBox>
#include <QToolBar>
#include <QStatusBar>
class MainWindow : public QMainWindow
......@@ -29,6 +31,11 @@ private:
QAction *aboutAction;
QAction *camHome;
QToolBar *toolBar;
QStatusBar *statusBar;
public:
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