diff options
author | Friedemann Kleint <Friedemann.Kleint@nokia.com> | 2012-06-27 14:43:05 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-07-03 09:23:06 +0200 |
commit | fad1730d19b573661b6527146fe13661e5ae1f72 (patch) | |
tree | c39523e1f817d746237a516be7f9ecc6c370ce7d /src/designer/src/designer/qdesigner_workbench.cpp | |
parent | 26b79c6115cb9cfc8ed03e5f94c39b36bb02d873 (diff) |
Designer: Fix crash when switching from docked to multiple windows.
Make sure the preference dialog is destroyed before changing the
UI mode by introducing a flag that is set on UI mode changes,
triggering the update afterwards.
Change-Id: I9c488ba6b1b24faccb0a1606994aaf0474b56fc2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@nokia.com>
Diffstat (limited to 'src/designer/src/designer/qdesigner_workbench.cpp')
-rw-r--r-- | src/designer/src/designer/qdesigner_workbench.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/src/designer/src/designer/qdesigner_workbench.cpp b/src/designer/src/designer/qdesigner_workbench.cpp index cbb1e83e8..5202a8006 100644 --- a/src/designer/src/designer/qdesigner_workbench.cpp +++ b/src/designer/src/designer/qdesigner_workbench.cpp @@ -182,7 +182,8 @@ QDesignerWorkbench::QDesignerWorkbench() : m_globalMenuBar(new QMenuBar), m_mode(NeutralMode), m_dockedMainWindow(0), - m_state(StateInitializing) + m_state(StateInitializing), + m_uiSettingsChanged(false) { QDesignerSettings settings(m_core); @@ -246,7 +247,7 @@ QDesignerWorkbench::QDesignerWorkbench() : { // Add application specific options pages QDesignerAppearanceOptionsPage *appearanceOptions = new QDesignerAppearanceOptionsPage(m_core); - connect(appearanceOptions, SIGNAL(settingsChangedDelayed()), this, SLOT(restoreUISettings())); + connect(appearanceOptions, SIGNAL(settingsChanged()), this, SLOT(notifyUISettingsChanged())); QList<QDesignerOptionsPageInterface*> optionsPages = m_core->optionsPages(); optionsPages.push_front(appearanceOptions); m_core->setOptionsPages(optionsPages); @@ -1061,6 +1062,25 @@ void QDesignerWorkbench::setFormWindowMinimized(QDesignerFormWindow *fw, bool mi } } +/* Applies UI mode changes using Timer-0 delayed signal + * signal to make sure the preferences dialog is closed and destroyed + * before a possible switch from docked mode to top-level mode happens. + * (The switch deletes the main window, which the preference dialog is + * a child of -> BOOM) */ + +void QDesignerWorkbench::applyUiSettings() +{ + if (m_uiSettingsChanged) { + m_uiSettingsChanged = false; + QTimer::singleShot(0, this, SLOT(restoreUISettings())); + } +} + +void QDesignerWorkbench::notifyUISettingsChanged() +{ + m_uiSettingsChanged = true; +} + void QDesignerWorkbench::restoreUISettings() { UIMode mode = QDesignerSettings(m_core).uiMode(); |