Commit 0624fb56 authored by con's avatar con
Browse files

Be more robust wrt restoring settings.

Make sure that we give the QMainWindow always a valid layout before
restoring settings, so if something goes wrong with that, we don't end
up with a broken layout.
parent 5435b096
......@@ -80,7 +80,8 @@ SharedSubWindow::~SharedSubWindow()
QHash<QString, QVariant> EditorWidget::m_globalState = QHash<QString, QVariant>();
EditorWidget::EditorWidget(QWidget *formWindow)
: m_mainWindow(new Core::Utils::FancyMainWindow)
: m_mainWindow(new Core::Utils::FancyMainWindow),
QVBoxLayout *layout = new QVBoxLayout;
......@@ -125,7 +126,6 @@ void EditorWidget::setDefaultLayout()
m_globalState = m_mainWindow->saveSettings();
void EditorWidget::activate()
......@@ -133,10 +133,21 @@ void EditorWidget::activate()
for (int i=0; i < DesignerSubWindowCount; i++)
if (!m_initialized) {
// set a default layout, so if something goes wrong with
// restoring the settings below, there is a fallback
// (otherwise we end up with a broken mainwindow layout)
// we can't do it in the constructor, because the sub windows
// don't have their widgets yet there
m_initialized = true;
if (!m_globalState.isEmpty())
else {
m_globalState = m_mainWindow->saveSettings();
void EditorWidget::hideEvent(QHideEvent *)
......@@ -93,6 +93,7 @@ private:
SharedSubWindow* m_designerSubWindows[Designer::Constants::DesignerSubWindowCount];
QDockWidget *m_designerDockWidgets[Designer::Constants::DesignerSubWindowCount];
Core::Utils::FancyMainWindow *m_mainWindow;
bool m_initialized;
static QHash<QString, QVariant> m_globalState;
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