From 096ab3b8edff8c9d57cf91cd6f2452dff4bce2a6 Mon Sep 17 00:00:00 2001 From: sithlord48 Date: Sat, 4 Jan 2025 19:23:42 -0500 Subject: [PATCH] refactor: ActionDialog, set the current screen combo without the need to track how many items are in the combobox with an additional int variable --- src/apps/deskflow-gui/dialogs/ActionDialog.cpp | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/apps/deskflow-gui/dialogs/ActionDialog.cpp b/src/apps/deskflow-gui/dialogs/ActionDialog.cpp index da52d3649..1febe4c2f 100644 --- a/src/apps/deskflow-gui/dialogs/ActionDialog.cpp +++ b/src/apps/deskflow-gui/dialogs/ActionDialog.cpp @@ -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); } }