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:
sithlord48
2025-01-04 19:23:42 -05:00
committed by Nick Bolton
parent 1129303254
commit 096ab3b8ed

View File

@ -64,7 +64,6 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey &
ui->m_pGroupBoxScreens->setChecked(m_Action.haveScreens());
int idx = 0;
for (const Screen &screen : config.screens()) {
if (screen.isNull())
continue;
@ -75,9 +74,7 @@ ActionDialog::ActionDialog(QWidget *parent, const ServerConfig &config, Hotkey &
ui->m_pComboSwitchToScreen->addItem(screen.name());
if (screen.name() == m_Action.switchScreenName())
ui->m_pComboSwitchToScreen->setCurrentIndex(idx);
idx++;
ui->m_pComboSwitchToScreen->setCurrentIndex(ui->m_pComboSwitchToScreen->count() - 1);
}
}