MainWindow: Delay restoreWindowState

QLayout calls setMinimumSize, which breaks maximized state on Windows.

Task-number: QTCREATORBUG-9586
Change-Id: Ibd9ceb8bccbdf26c6369e86ad4918835d645ca1e
Reviewed-by: Eike Ziller <eike.ziller@digia.com>
Reviewed-by: Kai Koehne <kai.koehne@digia.com>
This commit is contained in:
Orgad Shaneh
2014-01-12 09:08:18 +02:00
committed by Kai Koehne
parent 4ba5a058ae
commit a97b449f2b
2 changed files with 12 additions and 3 deletions

View File

@@ -1077,9 +1077,8 @@ void MainWindow::readSettings()
QColor(Utils::StyleHelper::DEFAULT_BASE_COLOR)).value<QColor>());
}
if (!restoreGeometry(m_settings->value(QLatin1String(windowGeometryKey)).toByteArray()))
resize(1008, 700); // size without window decoration
restoreState(m_settings->value(QLatin1String(windowStateKey)).toByteArray());
// Delay restoreWindowState, since it is overridden by LayoutRequest event
QTimer::singleShot(0, this, SLOT(restoreWindowState()));
bool modeSelectorVisible = m_settings->value(QLatin1String(modeSelectorVisibleKey), true).toBool();
ModeManager::setModeSelectorVisible(modeSelectorVisible);
@@ -1262,3 +1261,12 @@ bool MainWindow::showWarningWithOptions(const QString &title,
return showOptionsDialog(settingsCategory, settingsId);
return false;
}
void MainWindow::restoreWindowState()
{
m_settings->beginGroup(QLatin1String(settingsGroup));
if (!restoreGeometry(m_settings->value(QLatin1String(windowGeometryKey)).toByteArray()))
resize(1008, 700); // size without window decoration
restoreState(m_settings->value(QLatin1String(windowStateKey)).toByteArray());
m_settings->endGroup();
}

View File

@@ -149,6 +149,7 @@ private slots:
void setSidebarVisible(bool visible);
void destroyVersionDialog();
void openDelayedFiles();
void restoreWindowState();
private:
void updateContextObject(const QList<IContext *> &context);