Skip to content
Browse files

Make the top toolbar optional.

The batch size widget should generally be left at its default.
  • Loading branch information...
1 parent f148c91 commit fe9b5aff7d7e47606d06aaa0dd549f8eb3b2c345 @ajclinto committed May 28, 2013
Showing with 24 additions and 1 deletion.
  1. +20 −1 Window.C
  2. +4 −0 Window.h
View
21 Window.C
@@ -142,16 +142,24 @@ Window::Window(int argc, char *argv[])
myDisplayMenu, theDisplayNames, myDisplay, theDisplayCount, 0);
myDisplayMenu->addSeparator();
+
myDisplayDimmer = new QAction(tr("&Limit Brightness"), this);
myDisplayDimmer->setCheckable(true);
myDisplayMenu->addAction(myDisplayDimmer);
+ myDisplayShowToolBar = new QAction(tr("&Show Toolbar"), this);
+ myDisplayShowToolBar->setCheckable(true);
+ myDisplayMenu->addAction(myDisplayShowToolBar);
+
connect(myDisplayGroup, SIGNAL(triggered(QAction *)),
myMemView, SLOT(display(QAction *)));
connect(myDisplayDimmer, SIGNAL(triggered()),
myMemView, SLOT(dimmer()));
+ connect(myDisplayShowToolBar, SIGNAL(toggled(bool)),
+ this, SLOT(toolbar(bool)));
+
// This menu should be ordered the same as the MV_Data* defines in
// mv_ipc.h
static const char *theDataTypeNames[theDataTypeCount] = {
@@ -178,7 +186,6 @@ Window::Window(int argc, char *argv[])
myToolBar = new QToolBar("Tools");
myToolBar->setAllowedAreas(Qt::TopToolBarArea | Qt::BottomToolBarArea);
- addToolBar(Qt::TopToolBarArea, myToolBar);
LogSlider *slider = new LogSlider("Batch Size", 15, 15);
@@ -203,6 +210,18 @@ Window::sizeHint() const
return theDefaultSize;
}
+void
+Window::toolbar(bool value)
+{
+ if (value)
+ {
+ addToolBar(Qt::TopToolBarArea, myToolBar);
+ myToolBar->show();
+ }
+ else
+ removeToolBar(myToolBar);
+}
+
QActionGroup *
Window::createActionGroup(
QMenu *menu,
View
4 Window.h
@@ -75,6 +75,9 @@ class Window : public QMainWindow { Q_OBJECT
int count,
int def_action);
+public slots:
+ void toolbar(bool value);
+
private:
QMenu *myFileMenu;
QAction *myQuit;
@@ -94,6 +97,7 @@ class Window : public QMainWindow { Q_OBJECT
QActionGroup *myDisplayGroup;
QAction *myDisplay[theDisplayCount];
QAction *myDisplayDimmer;
+ QAction *myDisplayShowToolBar;
static const int theDataTypeCount = 6;
QMenu *myDataTypeMenu;

0 comments on commit fe9b5af

Please sign in to comment.
Something went wrong with that request. Please try again.