kcms: Use flat QGroupBoxes and set documentMode on QTabWidgets

Makes it consistent with other KCMs and and Kirigami KCMs.

**Before:**

![Screenshot_20240809_181201.png](/uploads/ff17bdcbdacda38d4abe752054d7f6d2/Screenshot_20240809_181201.png){width=431 height=399}![Screenshot_20240809_181210.png](/uploads/2e360efae4dd8982ab0a7b7af7ec85b4/Screenshot_20240809_181210.png){width=430 height=398}![Screenshot_20240809_181155.png](/uploads/6f534ffad87350a4d8fd47735f1c8c60/Screenshot_20240809_181155.png){width=431 height=399}

**After:**

![Screenshot_20240809_181243.png](/uploads/94babd127faaa8021054b7c46c806f93/Screenshot_20240809_181243.png){width=433 height=358}![Screenshot_20240809_181251.png](/uploads/25bd2d99ada694173ba875006dbe57bc/Screenshot_20240809_181251.png){width=436 height=361}

![Screenshot_20240809_181236.png](/uploads/03f0fb73e357728ae558649381cecdf7/Screenshot_20240809_181236.png){width=443 height=367}

@teams/vdg
This commit is contained in:
Thomas Duckworth 2024-08-13 18:04:14 +00:00 committed by Vlad Zahorodnii
parent 989b9a520d
commit 4019989959
6 changed files with 35 additions and 3 deletions

View file

@ -110,6 +110,12 @@ if(KWIN_BUILD_KCMS)
) )
endif() endif()
if(KWIN_BUILD_TABBOX AND KWIN_BUILD_KCMS)
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
WidgetsAddons
)
endif()
find_package(Threads) find_package(Threads)
set_package_properties(Threads PROPERTIES set_package_properties(Threads PROPERTIES
PURPOSE "Needed for VirtualTerminal support in KWin Wayland" PURPOSE "Needed for VirtualTerminal support in KWin Wayland"

View file

@ -13,6 +13,9 @@
<layout class="QVBoxLayout" name="verticalLayout"> <layout class="QVBoxLayout" name="verticalLayout">
<item> <item>
<widget class="QGroupBox" name="groupBox_1"> <widget class="QGroupBox" name="groupBox_1">
<property name="flat">
<bool>true</bool>
</property>
<property name="title"> <property name="title">
<string>Inactive Inner Window Actions</string> <string>Inactive Inner Window Actions</string>
</property> </property>
@ -180,6 +183,9 @@
</item> </item>
<item> <item>
<widget class="QGroupBox" name="groupBox_2"> <widget class="QGroupBox" name="groupBox_2">
<property name="flat">
<bool>true</bool>
</property>
<property name="title"> <property name="title">
<string>Inner Window, Titlebar and Frame Actions</string> <string>Inner Window, Titlebar and Frame Actions</string>
</property> </property>

View file

@ -65,6 +65,7 @@ KWinOptions::KWinOptions(QObject *parent, const KPluginMetaData &data)
QVBoxLayout *layout = new QVBoxLayout(widget()); QVBoxLayout *layout = new QVBoxLayout(widget());
layout->setContentsMargins(0, 0, 0, 0); layout->setContentsMargins(0, 0, 0, 0);
tab = new QTabWidget(widget()); tab = new QTabWidget(widget());
tab->setDocumentMode(true);
layout->addWidget(tab); layout->addWidget(tab);
const auto connectKCM = [this](KCModule *mod) { const auto connectKCM = [this](KCModule *mod) {

View file

@ -16,6 +16,9 @@
<property name="title"> <property name="title">
<string>Titlebar Actions</string> <string>Titlebar Actions</string>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout_1"> <layout class="QFormLayout" name="formLayout_1">
<property name="formAlignment"> <property name="formAlignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set> <set>Qt::AlignHCenter|Qt::AlignTop</set>
@ -142,6 +145,9 @@
<property name="title"> <property name="title">
<string>Titlebar and Frame Actions</string> <string>Titlebar and Frame Actions</string>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
<property name="alignment"> <property name="alignment">
<set>Qt::AlignCenter</set> <set>Qt::AlignCenter</set>
</property> </property>
@ -223,7 +229,7 @@
<item row="1" column="1"> <item row="1" column="1">
<widget class="QComboBox" name="kcfg_CommandActiveTitlebar1"> <widget class="QComboBox" name="kcfg_CommandActiveTitlebar1">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -338,7 +344,7 @@
<item row="2" column="1"> <item row="2" column="1">
<widget class="QComboBox" name="kcfg_CommandActiveTitlebar2"> <widget class="QComboBox" name="kcfg_CommandActiveTitlebar2">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -453,7 +459,7 @@
<item row="3" column="1"> <item row="3" column="1">
<widget class="QComboBox" name="kcfg_CommandActiveTitlebar3"> <widget class="QComboBox" name="kcfg_CommandActiveTitlebar3">
<property name="sizePolicy"> <property name="sizePolicy">
<sizepolicy hsizetype="Expanding" vsizetype="Fixed"> <sizepolicy hsizetype="Fixed" vsizetype="Fixed">
<horstretch>0</horstretch> <horstretch>0</horstretch>
<verstretch>0</verstretch> <verstretch>0</verstretch>
</sizepolicy> </sizepolicy>
@ -588,6 +594,9 @@
<property name="title"> <property name="title">
<string>Maximize Button Actions</string> <string>Maximize Button Actions</string>
</property> </property>
<property name="flat">
<bool>true</bool>
</property>
<layout class="QFormLayout" name="formLayout_2"> <layout class="QFormLayout" name="formLayout_2">
<property name="formAlignment"> <property name="formAlignment">
<set>Qt::AlignHCenter|Qt::AlignTop</set> <set>Qt::AlignHCenter|Qt::AlignTop</set>

View file

@ -27,6 +27,7 @@ target_link_libraries(kcm_kwintabbox
KF6::Package KF6::Package
KF6::Service KF6::Service
KF6::XmlGui # For kkeysequencewidget KF6::XmlGui # For kkeysequencewidget
KF6::WidgetsAddons
) )
if (KWIN_BUILD_X11) if (KWIN_BUILD_X11)
target_link_libraries(kcm_kwintabbox target_link_libraries(kcm_kwintabbox

View file

@ -22,6 +22,7 @@
#include <QSpacerItem> #include <QSpacerItem>
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QStandardPaths> #include <QStandardPaths>
#include <QStyle>
#include <QTabWidget> #include <QTabWidget>
#include <QVBoxLayout> #include <QVBoxLayout>
@ -29,6 +30,7 @@
#include <KLocalizedString> #include <KLocalizedString>
#include <KNSWidgets/Button> #include <KNSWidgets/Button>
#include <KPluginFactory> #include <KPluginFactory>
#include <KSeparator>
#include <KTitleWidget> #include <KTitleWidget>
// Plasma // Plasma
#include <KPackage/Package> #include <KPackage/Package>
@ -55,6 +57,7 @@ KWinTabBoxConfig::KWinTabBoxConfig(QObject *parent, const KPluginMetaData &data)
, m_data(new KWinTabboxData(this)) , m_data(new KWinTabboxData(this))
{ {
QTabWidget *tabWidget = new QTabWidget(widget()); QTabWidget *tabWidget = new QTabWidget(widget());
tabWidget->setDocumentMode(true);
m_primaryTabBoxUi = new KWinTabBoxConfigForm(KWinTabBoxConfigForm::TabboxType::Main, m_primaryTabBoxUi = new KWinTabBoxConfigForm(KWinTabBoxConfigForm::TabboxType::Main,
m_data->tabBoxConfig(), m_data->tabBoxConfig(),
m_data->shortcutConfig(), m_data->shortcutConfig(),
@ -74,17 +77,23 @@ KWinTabBoxConfig::KWinTabBoxConfig(QObject *parent, const KPluginMetaData &data)
}); });
QHBoxLayout *buttonBar = new QHBoxLayout(); 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); QSpacerItem *buttonBarSpacer = new QSpacerItem(40, 20, QSizePolicy::Expanding, QSizePolicy::Minimum);
buttonBar->addItem(buttonBarSpacer); buttonBar->addItem(buttonBarSpacer);
buttonBar->addWidget(ghnsButton); buttonBar->addWidget(ghnsButton);
QVBoxLayout *layout = new QVBoxLayout(widget()); QVBoxLayout *layout = new QVBoxLayout(widget());
layout->setContentsMargins(0, 0, 0, 0);
KTitleWidget *infoLabel = new KTitleWidget(tabWidget); KTitleWidget *infoLabel = new KTitleWidget(tabWidget);
infoLabel->setText(i18n("Focus policy settings limit the functionality of navigating through windows."), infoLabel->setText(i18n("Focus policy settings limit the functionality of navigating through windows."),
KTitleWidget::InfoMessage); KTitleWidget::InfoMessage);
infoLabel->setIcon(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft); infoLabel->setIcon(KTitleWidget::InfoMessage, KTitleWidget::ImageLeft);
layout->addWidget(infoLabel, 0); layout->addWidget(infoLabel, 0);
layout->addWidget(tabWidget, 1); layout->addWidget(tabWidget, 1);
KSeparator *separator = new KSeparator();
layout->addWidget(separator);
layout->addLayout(buttonBar); layout->addLayout(buttonBar);
widget()->setLayout(layout); widget()->setLayout(layout);