forked from qt-creator/qt-creator
ProjectExplorer: Make project window state persistent
Task-number: QTCREATORBUG-24690 Change-Id: Ia261fc5a98681676e8d67e6d840f2f48073cdbb2 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -661,8 +661,38 @@ void ProjectWindow::activateProjectPanel(Utils::Id panelId)
|
|||||||
d->activateProjectPanel(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;
|
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 SelectorDelegate::sizeHint(const QStyleOptionViewItem &option, const QModelIndex &index) const
|
||||||
{
|
{
|
||||||
QSize s = QStyledItemDelegate::sizeHint(option, index);
|
QSize s = QStyledItemDelegate::sizeHint(option, index);
|
||||||
|
|||||||
@@ -64,6 +64,12 @@ public:
|
|||||||
void activateProjectPanel(Utils::Id panelId);
|
void activateProjectPanel(Utils::Id panelId);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void hideEvent(QHideEvent *event) override;
|
||||||
|
void showEvent(QShowEvent *event) override;
|
||||||
|
|
||||||
|
void savePersistentSettings() const;
|
||||||
|
void loadPersistentSettings();
|
||||||
|
|
||||||
const std::unique_ptr<ProjectWindowPrivate> d;
|
const std::unique_ptr<ProjectWindowPrivate> d;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user