Commit 9c3724c7 authored by finetjul's avatar finetjul
Browse files

BUG: Make the toolbars respond to the trigger signal of menu qactions

Problem: minimize application, restore it and the module panel disappear
When the application is minimized, QDockWidget receive the HideEvent and
fire its signal visibilityChanged that got connected to the menu QAction
which fire its own signal toggled(bool).
If the QDockWidget::setVisible(bool) is connected to this toggled() signal
setVisible(false) would be called and really hide the QDockWidget (before
it wasn't really hidden, see QWidget::IsVisibleTo() for more info).
To avoid all this issue, QDockWidgets::setVisible should only respond to
the triggered(bool) signals of the menu QAction.
For consistency, apply the same logic to the QToolBars and their associated
menu QActions.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@15645 3bd1e089-480b-0410-8dfb-8563597acbee
parent 5eac2934
......@@ -900,7 +900,7 @@
<connections>
<connection>
<sender>actionWindowShowMainPanel</sender>
<signal>toggled(bool)</signal>
<signal>triggered(bool)</signal>
<receiver>PanelDockWidget</receiver>
<slot>setVisible(bool)</slot>
<hints>
......@@ -932,7 +932,7 @@
</connection>
<connection>
<sender>actionWindowToolbarsLayout</sender>
<signal>toggled(bool)</signal>
<signal>triggered(bool)</signal>
<receiver>LayoutToolBar</receiver>
<slot>setVisible(bool)</slot>
<hints>
......@@ -948,7 +948,7 @@
</connection>
<connection>
<sender>actionWindowToolbarsMouseMode</sender>
<signal>toggled(bool)</signal>
<signal>triggered(bool)</signal>
<receiver>MouseModeToolBar</receiver>
<slot>setVisible(bool)</slot>
<hints>
......@@ -964,7 +964,7 @@
</connection>
<connection>
<sender>actionWindowToolbarsLoadSave</sender>
<signal>toggled(bool)</signal>
<signal>triggered(bool)</signal>
<receiver>MainToolBar</receiver>
<slot>setVisible(bool)</slot>
<hints>
......@@ -980,7 +980,7 @@
</connection>
<connection>
<sender>actionWindowToolbarsUndoRedo</sender>
<signal>toggled(bool)</signal>
<signal>triggered(bool)</signal>
<receiver>UndoRedoToolBar</receiver>
<slot>setVisible(bool)</slot>
<hints>
......@@ -996,7 +996,7 @@
</connection>
<connection>
<sender>actionWindowToolbarsModules</sender>
<signal>toggled(bool)</signal>
<signal>triggered(bool)</signal>
<receiver>ModuleToolBar</receiver>
<slot>setVisible(bool)</slot>
<hints>
......@@ -1012,7 +1012,7 @@
</connection>
<connection>
<sender>actionWindowToolbarsView</sender>
<signal>toggled(bool)</signal>
<signal>triggered(bool)</signal>
<receiver>ViewToolBar</receiver>
<slot>setVisible(bool)</slot>
<hints>
......
......@@ -124,8 +124,13 @@ void qSlicerMainWindowPrivate::setupUi(QMainWindow * mainWindow)
SLOT(setMRMLScene(vtkMRMLScene*)));
// Hide the Layout toolbar by default
this->actionWindowToolbarsUndoRedo->setChecked(false);
this->actionWindowToolbarsLayout->setChecked(false);
// The setVisibility slot of the toolbar is connected QAction::triggered signal
// It's done for a long list of reasons. If you change this behavior, make sure
// minimizing the application and restore it doesn't hide the module panel. check
// also the geometry and the state of the menu qactions are correctly restored when
// loading slicer.
this->actionWindowToolbarsUndoRedo->trigger();
this->actionWindowToolbarsLayout->trigger();
// Instanciate and assign the layout manager to the slicer application
qSlicerLayoutManager* layoutManager = new qSlicerLayoutManager(this->CentralWidget);
......@@ -371,7 +376,7 @@ void qSlicerMainWindow::setupMenuActions()
qSlicerMainWindowCore_connect(FeedbackCommunitySlicerVisualBlog);
//connect ToolBars actions
connect(d->actionWindowToolbarsModuleSelector, SIGNAL(toggled(bool)),
connect(d->actionWindowToolbarsModuleSelector, SIGNAL(triggered(bool)),
d->ModuleSelectorToolBar, SLOT(setVisible(bool)));
}
#undef qSlicerMainWindowCore_connect
......
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