diff options
| author | Méven Car <[email protected]> | 2024-05-08 17:08:37 +0200 |
|---|---|---|
| committer | Méven Car <[email protected]> | 2026-03-03 10:42:29 +0000 |
| commit | 6ca1492f6c79869a517879a610d48a4c629e7815 (patch) | |
| tree | 473e21aef3df59faab923358da75c6e937200eb4 /src | |
| parent | 1109e21241b82de9e7a0296648fa345f4e366b4d (diff) | |
settings: improve confirmation page layout
Align horizontally the form and make sure the label have enough room.
Diffstat (limited to 'src')
| -rw-r--r-- | src/settings/interface/confirmationssettingspage.cpp | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/settings/interface/confirmationssettingspage.cpp b/src/settings/interface/confirmationssettingspage.cpp index 1cb4b82ca..b733fa741 100644 --- a/src/settings/interface/confirmationssettingspage.cpp +++ b/src/settings/interface/confirmationssettingspage.cpp @@ -45,6 +45,7 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent) m_confirmClosingMultipleTabs(nullptr) { QFormLayout *topLayout = new QFormLayout(this); + topLayout->setFormAlignment(Qt::AlignHCenter); QLabel *confirmLabelKde = new QLabel(i18nc("@title:group", "Ask for confirmation in all KDE applications when:"), this); confirmLabelKde->setWordWrap(true); @@ -74,14 +75,13 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent) m_confirmScriptExecution = new QComboBox(this); m_confirmScriptExecution->addItems({i18n("Always ask"), i18n("Open in application"), i18n("Run script")}); - topLayout->addRow(confirmLabelKde); + topLayout->addRow(confirmLabelKde, m_confirmDelete); 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); + + topLayout->addRow(confirmLabelDolphin, m_confirmClosingMultipleTabs); #if HAVE_TERMINAL topLayout->addRow(nullptr, m_confirmClosingTerminalRunningProgram); @@ -89,6 +89,7 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent) topLayout->addRow(nullptr, m_confirmOpenManyFolders); topLayout->addRow(nullptr, m_confirmOpenManyTerminals); + if (KProtocolInfo::isKnownProtocol(QStringLiteral("admin"))) { topLayout->addRow(nullptr, m_confirmRisksOfActingAsAdmin); } else { @@ -101,6 +102,17 @@ ConfirmationsSettingsPage::ConfirmationsSettingsPage(QWidget *parent) loadSettings(); + int minimumWidth = 0; + for (QLabel *label : {confirmLabelKde, confirmLabelDolphin, executableScriptLabel}) { + QFontMetrics fm(label->font()); + minimumWidth = qMax(minimumWidth, fm.horizontalAdvance(label->text())); + } + + for (QLabel *label : {confirmLabelKde, confirmLabelDolphin, executableScriptLabel}) { + label->setMinimumWidth(minimumWidth); + label->setAlignment(topLayout->labelAlignment()); + } + connect(m_confirmMoveToTrash, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); connect(m_confirmEmptyTrash, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); connect(m_confirmDelete, &QCheckBox::toggled, this, &ConfirmationsSettingsPage::changed); |
