]> cloud.milkyroute.net Git - dolphin.git/commitdiff
settings: use QFormLayout for confirmation tab
authorMéven Car <meven@kde.org>
Tue, 7 May 2024 16:43:16 +0000 (18:43 +0200)
committerMéven Car <meven@kde.org>
Tue, 7 May 2024 16:49:43 +0000 (18:49 +0200)
For consistency.

src/settings/interface/confirmationssettingspage.cpp

index c43ff0474cc7941b7d6f46868b0b8f67a9fb0d4c..ec63cbb674271d9732f38f311574ed48e542d67b 100644 (file)
@@ -13,9 +13,8 @@
 
 #include <QCheckBox>
 #include <QComboBox>
-#include <QHBoxLayout>
+#include <QFormLayout>
 #include <QLabel>
-#include <QVBoxLayout>
 
 namespace
 {
@@ -41,7 +40,7 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent)
 
     m_confirmClosingMultipleTabs(nullptr)
 {
-    QVBoxLayout *topLayout = new QVBoxLayout(this);
+    QFormLayout *topLayout = new QFormLayout(this);
 
     QLabel *confirmLabelKde = new QLabel(i18nc("@title:group", "Ask for confirmation in all KDE applications when:"), this);
     confirmLabelKde->setWordWrap(true);
@@ -63,34 +62,30 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent)
     m_confirmOpenManyFolders = new QCheckBox(i18nc("@option:check Ask for confirmation in Dolphin when", "Opening many folders at once"), this);
     m_confirmOpenManyTerminals = new QCheckBox(i18nc("@option:check Ask for confirmation in Dolphin when", "Opening many terminals at once"), this);
 
-    QHBoxLayout *executableScriptLayout = new QHBoxLayout();
     QLabel *executableScriptLabel = new QLabel(i18nc("@title:group", "When opening an executable file:"), this);
     executableScriptLabel->setWordWrap(true);
-    executableScriptLayout->addWidget(executableScriptLabel);
 
     m_confirmScriptExecution = new QComboBox(this);
     m_confirmScriptExecution->addItems({i18n("Always ask"), i18n("Open in application"), i18n("Run script")});
-    executableScriptLayout->addWidget(m_confirmScriptExecution);
 
-    topLayout->addWidget(confirmLabelKde);
-    topLayout->addWidget(m_confirmMoveToTrash);
-    topLayout->addWidget(m_confirmEmptyTrash);
-    topLayout->addWidget(m_confirmDelete);
-    topLayout->addSpacing(Dolphin::VERTICAL_SPACER_HEIGHT);
-    topLayout->addWidget(confirmLabelDolphin);
-    topLayout->addWidget(m_confirmClosingMultipleTabs);
+    topLayout->addRow(confirmLabelKde);
+    topLayout->addRow(nullptr, m_confirmMoveToTrash);
+    topLayout->addRow(nullptr, m_confirmEmptyTrash);
+    topLayout->addRow(nullptr, m_confirmDelete);
+
+    topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
+    topLayout->addRow(confirmLabelDolphin);
+    topLayout->addRow(nullptr, m_confirmClosingMultipleTabs);
 
 #if HAVE_TERMINAL
-    topLayout->addWidget(m_confirmClosingTerminalRunningProgram);
+    topLayout->addRow(nullptr, m_confirmClosingTerminalRunningProgram);
 #endif
 
-    topLayout->addWidget(m_confirmOpenManyFolders);
-    topLayout->addWidget(m_confirmOpenManyTerminals);
-
-    topLayout->addSpacing(Dolphin::VERTICAL_SPACER_HEIGHT);
-    topLayout->addLayout(executableScriptLayout);
+    topLayout->addRow(nullptr, m_confirmOpenManyFolders);
+    topLayout->addRow(nullptr, m_confirmOpenManyTerminals);
 
-    topLayout->addStretch();
+    topLayout->addItem(new QSpacerItem(0, Dolphin::VERTICAL_SPACER_HEIGHT, QSizePolicy::Fixed, QSizePolicy::Fixed));
+    topLayout->addRow(executableScriptLabel, m_confirmScriptExecution);
 
     loadSettings();