From 604cfd04fda523733f2127190789a82fd822fd49 Mon Sep 17 00:00:00 2001 From: Thomas Duckworth Date: Tue, 13 Aug 2024 18:04:14 +0000 Subject: [PATCH] feat: use flat QGroupBoxes and set documentMode on QTabWidgets Makes it consistent with other KCMs and and Kirigami KCMs. @teams/vdg --- CMakeLists.txt | 1 + kcms/options/actions.ui | 6 ++++++ kcms/options/main.cpp | 1 + kcms/options/mouse.ui | 15 ++++++++++++--- kcms/tabbox/CMakeLists.txt | 1 + kcms/tabbox/main.cpp | 11 +++++++++++ 6 files changed, 32 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8d7d8c43ab..d7f13ab683 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -47,6 +47,7 @@ include(ECMGenerateQmlTypes) find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS Crash DBusAddons + WidgetsAddons ) find_package(KF6Kirigami ${KF6_MIN_VERSION} CONFIG) diff --git a/kcms/options/actions.ui b/kcms/options/actions.ui index a022865e43..8acaf802dc 100644 --- a/kcms/options/actions.ui +++ b/kcms/options/actions.ui @@ -20,6 +20,9 @@ SPDX-License-Identifier: GPL-2.0-or-later + + true + Inactive Inner Window Actions @@ -187,6 +190,9 @@ SPDX-License-Identifier: GPL-2.0-or-later + + true + Inner Window, Titlebar and Frame Actions diff --git a/kcms/options/main.cpp b/kcms/options/main.cpp index 56f73506e9..17c6850947 100644 --- a/kcms/options/main.cpp +++ b/kcms/options/main.cpp @@ -65,6 +65,7 @@ KWinOptions::KWinOptions(QObject* parent, const KPluginMetaData& data) QVBoxLayout* layout = new QVBoxLayout(widget()); layout->setContentsMargins(0, 0, 0, 0); tab = new QTabWidget(widget()); + tab->setDocumentMode(true); layout->addWidget(tab); const auto connectKCM = [this](KCModule* mod) { diff --git a/kcms/options/mouse.ui b/kcms/options/mouse.ui index 9520cc0300..6e45d4af75 100644 --- a/kcms/options/mouse.ui +++ b/kcms/options/mouse.ui @@ -23,6 +23,9 @@ SPDX-License-Identifier: GPL-2.0-or-later Titlebar Actions + + true + Qt::AlignHCenter|Qt::AlignTop @@ -139,6 +142,9 @@ SPDX-License-Identifier: GPL-2.0-or-later Titlebar and Frame Actions + + true + Qt::AlignCenter @@ -220,7 +226,7 @@ SPDX-License-Identifier: GPL-2.0-or-later - + 0 0 @@ -325,7 +331,7 @@ SPDX-License-Identifier: GPL-2.0-or-later - + 0 0 @@ -430,7 +436,7 @@ SPDX-License-Identifier: GPL-2.0-or-later - + 0 0 @@ -555,6 +561,9 @@ SPDX-License-Identifier: GPL-2.0-or-later Maximize Button Actions + + true + Qt::AlignHCenter|Qt::AlignTop diff --git a/kcms/tabbox/CMakeLists.txt b/kcms/tabbox/CMakeLists.txt index e6c6417ecb..d3f21658a9 100644 --- a/kcms/tabbox/CMakeLists.txt +++ b/kcms/tabbox/CMakeLists.txt @@ -33,6 +33,7 @@ target_link_libraries(kcm_kwintabbox KF6::NewStuffWidgets KF6::Package KF6::Service + KF6::WidgetsAddons KF6::XmlGui Qt::Quick XCB::XCB diff --git a/kcms/tabbox/main.cpp b/kcms/tabbox/main.cpp index fa7ce8762b..d8ec8decb5 100644 --- a/kcms/tabbox/main.cpp +++ b/kcms/tabbox/main.cpp @@ -30,6 +30,7 @@ SPDX-License-Identifier: GPL-2.0-or-later #include #include #include +#include #include #include @@ -47,6 +48,7 @@ KWinTabBoxConfig::KWinTabBoxConfig(QObject* parent, const KPluginMetaData& data) , m_data(new KWinTabboxData(this)) { QTabWidget* tabWidget = new QTabWidget(widget()); + tabWidget->setDocumentMode(true); m_primaryTabBoxUi = new KWinTabBoxConfigForm(KWinTabBoxConfigForm::TabboxType::Main, m_data->tabBoxConfig(), m_data->shortcutConfig(), @@ -67,12 +69,19 @@ KWinTabBoxConfig::KWinTabBoxConfig(QObject* parent, const KPluginMetaData& data) }); QHBoxLayout* buttonBar = new QHBoxLayout(); + QStyle* style = widget()->style(); + + buttonBar->setContentsMargins(style->pixelMetric(QStyle::PM_LayoutLeftMargin), + 0, + style->pixelMetric(QStyle::PM_LayoutRightMargin), + style->pixelMetric(QStyle::PM_LayoutBottomMargin)); QSpacerItem* buttonBarSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); buttonBar->addItem(buttonBarSpacer); buttonBar->addWidget(ghnsButton); QVBoxLayout* layout = new QVBoxLayout(widget()); + layout->setContentsMargins(0, 0, 0, 0); KTitleWidget* infoLabel = new KTitleWidget(tabWidget); infoLabel->setText( i18n("Focus policy settings limit the functionality of navigating through windows."), @@ -80,6 +89,8 @@ KWinTabBoxConfig::KWinTabBoxConfig(QObject* parent, const KPluginMetaData& data) infoLabel->setIcon(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft); layout->addWidget(infoLabel, 0); layout->addWidget(tabWidget, 1); + KSeparator* separator = new KSeparator(); + layout->addWidget(separator); layout->addLayout(buttonBar); widget()->setLayout(layout);