ProjectExplorer: Make project window state persistent

Task-number: QTCREATORBUG-24690
Change-Id: Ia261fc5a98681676e8d67e6d840f2f48073cdbb2
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-10-06 14:05:45 +02:00
parent 6c841dfbd0
commit a8a6a9e774
2 changed files with 36 additions and 0 deletions

View File

@@ -661,8 +661,38 @@ void ProjectWindow::activateProjectPanel(Utils::Id panelId)
d->activateProjectPanel(panelId);
}
void ProjectWindow::hideEvent(QHideEvent *event)
{
savePersistentSettings();
FancyMainWindow::hideEvent(event);
}
void ProjectWindow::showEvent(QShowEvent *event)
{
loadPersistentSettings();
FancyMainWindow::showEvent(event);
}
ProjectWindow::~ProjectWindow() = default;
const char PROJECT_WINDOW_KEY[] = "ProjectExplorer.ProjectWindow";
void ProjectWindow::savePersistentSettings() const
{
QSettings * const settings = ICore::settings();
settings->beginGroup(PROJECT_WINDOW_KEY);
saveSettings(settings);
settings->endGroup();
}
void ProjectWindow::loadPersistentSettings()
{
QSettings * const settings = ICore::settings();
settings->beginGroup(PROJECT_WINDOW_KEY);
restoreSettings(settings);
settings->endGroup();
}
QSize SelectorDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
{
QSize s = QStyledItemDelegate::sizeHint(option, index);