Remember last viewed page in Options dialog (#15230)

This commit is contained in:
Chocobo1 2021-07-28 11:11:00 +08:00 committed by GitHub
parent 1eb246c98b
commit 2d4d246268
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -180,6 +180,7 @@ OptionsDialog::OptionsDialog(QWidget *parent)
, m_ui {new Ui::OptionsDialog}
, m_storeDialogSize {SETTINGS_KEY("Size")}
, m_storeHSplitterSize {SETTINGS_KEY("HorizontalSplitterSizes")}
, m_storeLastViewedPage {SETTINGS_KEY("LastViewedPage")}
{
qDebug("-> Constructing Options");
m_ui->setupUi(this);
@ -570,6 +571,8 @@ OptionsDialog::OptionsDialog(QWidget *parent)
for (QSpinBox *widget : asConst(findChildren<QSpinBox *>()))
widget->installEventFilter(wheelEventEater);
m_ui->tabSelection->setCurrentRow(m_storeLastViewedPage);
Utils::Gui::resize(this, m_storeDialogSize);
show();
// Have to be called after show(), because splitter width needed
@ -619,6 +622,8 @@ OptionsDialog::~OptionsDialog()
hSplitterSizes.append(QString::number(size));
m_storeHSplitterSize = hSplitterSizes;
m_storeLastViewedPage = m_ui->tabSelection->currentRow();
delete m_ui;
}

View File

@ -181,6 +181,7 @@ private:
Ui::OptionsDialog *m_ui;
SettingValue<QSize> m_storeDialogSize;
SettingValue<QStringList> m_storeHSplitterSize;
SettingValue<int> m_storeLastViewedPage;
QPushButton *m_applyButton;