refactor: ActionDialog, set the current screen combo without the need to track how many items are in the combobox with an additional int variable
This commit is contained in:
parent
1129303254
commit
096ab3b8ed
1 changed files with 1 additions and 4 deletions
|
|
@ -64,7 +64,6 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey &
|
||||||
|
|
||||||
ui->m_pGroupBoxScreens->setChecked(m_Action.haveScreens());
|
ui->m_pGroupBoxScreens->setChecked(m_Action.haveScreens());
|
||||||
|
|
||||||
int idx = 0;
|
|
||||||
for (const Screen &screen : config.screens()) {
|
for (const Screen &screen : config.screens()) {
|
||||||
if (screen.isNull())
|
if (screen.isNull())
|
||||||
continue;
|
continue;
|
||||||
|
|
@ -75,9 +74,7 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey &
|
||||||
|
|
||||||
ui->m_pComboSwitchToScreen->addItem(screen.name());
|
ui->m_pComboSwitchToScreen->addItem(screen.name());
|
||||||
if (screen.name() == m_Action.switchScreenName())
|
if (screen.name() == m_Action.switchScreenName())
|
||||||
ui->m_pComboSwitchToScreen->setCurrentIndex(idx);
|
ui->m_pComboSwitchToScreen->setCurrentIndex(ui->m_pComboSwitchToScreen->count() - 1);
|
||||||
|
|
||||||
idx++;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue