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()
if(KWIN_BUILD_TABBOX AND KWIN_BUILD_KCMS)
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
WidgetsAddons
)
endif()
find_package(Threads)
set_package_properties(Threads PROPERTIES
PURPOSE "Needed for VirtualTerminal support in KWin Wayland"

View file

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

View file

@ -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) {

View file

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

View file

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

View file

@ -22,6 +22,7 @@
#include <QSpacerItem>
#include <QStandardItemModel>
#include <QStandardPaths>
#include <QStyle>
#include <QTabWidget>
#include <QVBoxLayout>
@ -29,6 +30,7 @@
#include <KLocalizedString>
#include <KNSWidgets/Button>
#include <KPluginFactory>
#include <KSeparator>
#include <KTitleWidget>
// Plasma
#include <KPackage/Package>
@ -55,6 +57,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(),
@ -74,17 +77,23 @@ 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."),
KTitleWidget::InfoMessage);
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);