Fix opening correct panel in the preferences dialog via the contextmenu (#583)

This commit is contained in:
fcasal 2018-07-18 08:27:29 +01:00 committed by xarkes
parent db682f6ef9
commit 662837e38e

View File

@ -20,8 +20,7 @@ PreferencesDialog::PreferencesDialog(QWidget *parent)
setAttribute(Qt::WA_DeleteOnClose);
ui->setupUi(this);
QList<PreferenceCategory> prefs
{
QList<PreferenceCategory> prefs {
{
"General",
new GeneralOptionsWidget(this),
@ -61,12 +60,17 @@ PreferencesDialog::~PreferencesDialog()
void PreferencesDialog::showSection(PreferencesDialog::Section section)
{
QTreeWidgetItem *defitem;
switch (section) {
case Section::General:
ui->configPanel->setCurrentIndex(0);
defitem = ui->configCategories->topLevelItem(0);
ui->configCategories->setCurrentItem(defitem, 0);
break;
case Section::Disassembly:
ui->configPanel->setCurrentIndex(1);
defitem = ui->configCategories->topLevelItem(1);
ui->configCategories->setCurrentItem(defitem, 1);
break;
}
}