Skip to content

Commit

Permalink
feat: use flat QGroupBoxes and set documentMode on QTabWidgets
Browse files Browse the repository at this point in the history
Makes it consistent with other KCMs and and Kirigami KCMs.

@teams/vdg
  • Loading branch information
tduck973564 authored and romangg committed Oct 9, 2024
1 parent 351bad8 commit 604cfd0
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 3 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ include(ECMGenerateQmlTypes)
find_package(KF6 ${KF6_MIN_VERSION} REQUIRED COMPONENTS
Crash
DBusAddons
WidgetsAddons
)

find_package(KF6Kirigami ${KF6_MIN_VERSION} CONFIG)
Expand Down
6 changes: 6 additions & 0 deletions kcms/options/actions.ui
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
<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>
Expand Down Expand Up @@ -187,6 +190,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
</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>
Expand Down
1 change: 1 addition & 0 deletions kcms/options/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
15 changes: 12 additions & 3 deletions kcms/options/mouse.ui
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
<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>
Expand Down Expand Up @@ -139,6 +142,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
<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>
Expand Down Expand Up @@ -220,7 +226,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
<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>
Expand Down Expand Up @@ -325,7 +331,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
<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>
Expand Down Expand Up @@ -430,7 +436,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
<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>
Expand Down Expand Up @@ -555,6 +561,9 @@ SPDX-License-Identifier: GPL-2.0-or-later
<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>
Expand Down
1 change: 1 addition & 0 deletions kcms/tabbox/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ target_link_libraries(kcm_kwintabbox
KF6::NewStuffWidgets
KF6::Package
KF6::Service
KF6::WidgetsAddons
KF6::XmlGui
Qt::Quick
XCB::XCB
Expand Down
11 changes: 11 additions & 0 deletions kcms/tabbox/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
#include <QSpacerItem>
#include <QStandardItemModel>
#include <QStandardPaths>
#include <QStyle>
#include <QTabWidget>
#include <QVBoxLayout>

Expand All @@ -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(),
Expand All @@ -67,19 +69,28 @@ 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);

Expand Down

0 comments on commit 604cfd0

Please sign in to comment.