Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
VioletGiraffe committed Feb 5, 2023
1 parent b6ca209 commit 454ea27
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 3 deletions.
10 changes: 9 additions & 1 deletion settingsui/csettingsdialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,13 @@ CSettingsDialog::CSettingsDialog(QWidget *parent) :
ui->splitter->setStretchFactor(0, 0);
ui->splitter->setStretchFactor(1, 1);

connect(ui->pageList, &QListWidget::itemClicked, this, &CSettingsDialog::pageChanged);
connect(ui->pageList, &QListWidget::currentItemChanged, this, &CSettingsDialog::pageChanged);
ui->pageList->setResizeMode(QListWidget::Adjust);

new QShortcut(QKeySequence("Ctrl+Shift+W"), this, this, &CSettingsDialog::wipeSettings);

ui->pageList->setFocus();
setTabOrder(ui->pageList, nullptr);
}

CSettingsDialog::~CSettingsDialog()
Expand All @@ -40,7 +43,12 @@ CSettingsDialog& CSettingsDialog::addSettingsPage(CSettingsPage* page, const QSt
ui->pageList->addItem(item);

if (ui->pages->count() == 1)
{
ui->pageList->setCurrentRow(0);
setTabOrder(ui->pageList, page);
}
else
setTabOrder(ui->pages->widget(ui->pages->count() - 1), page);

ui->pageList->adjustSize();

Expand Down
17 changes: 15 additions & 2 deletions settingsui/csettingsdialog.ui
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<rect>
<x>0</x>
<y>0</y>
<width>741</width>
<width>622</width>
<height>437</height>
</rect>
</property>
Expand All @@ -26,11 +26,21 @@
<bool>false</bool>
</property>
<widget class="QListWidget" name="pageList"/>
<widget class="QStackedWidget" name="pages"/>
<widget class="QStackedWidget" name="pages">
<property name="minimumSize">
<size>
<width>50</width>
<height>0</height>
</size>
</property>
</widget>
</widget>
</item>
<item>
<widget class="QDialogButtonBox" name="buttonBox">
<property name="focusPolicy">
<enum>Qt::TabFocus</enum>
</property>
<property name="orientation">
<enum>Qt::Horizontal</enum>
</property>
Expand All @@ -41,6 +51,9 @@
</item>
</layout>
</widget>
<tabstops>
<tabstop>pageList</tabstop>
</tabstops>
<resources/>
<connections>
<connection>
Expand Down

0 comments on commit 454ea27

Please sign in to comment.