Krita is a free and open source cross-platform application that offers an end-to-end solution for creating digital art files from scratch built on the KDE and Qt frameworks.
C++
Handle tabbuttons and tool separators for Fusion better.
Wolthera van Hövell tot Westerflier04d3a9dab58f
diff --git a/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml b/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qmlindex 0cb3ea60ed..1d4969ed1b 100644--- a/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml+++ b/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml@@ -59,6 +59,7 @@ Control {ToolSeparator {Layout.fillHeight: true;+ palette.window: root.containsMouse? root.palette.highlight: root.palette.window;}ColumnLayout {diff --git a/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml b/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qmlindex 8f10f9be2b..8b096c9504 100644--- a/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml+++ b/plugins/dockers/textproperties/qml/OpenTypeFeatureSettings.qml@@ -145,6 +145,7 @@ TextPropertyBase {delegate: OpenTypeFeatureDelegate {width: ListView.view.width;+ required property var modelData;display: modelData.display;toolTip: display;sample: activeFeatureDelegate.sample;diff --git a/plugins/dockers/textproperties/qml/TextProperties.qml b/plugins/dockers/textproperties/qml/TextProperties.qmlindex 513ad2eb9f..2540ccb12a 100644--- a/plugins/dockers/textproperties/qml/TextProperties.qml+++ b/plugins/dockers/textproperties/qml/TextProperties.qml@@ -74,13 +74,13 @@ Control {anchors.right: parent.right;anchors.left: parent.left;anchors.top: parent.top;- TabButton {+ Kis.TabButtonBase {text: i18nc("@title:tab", "Character")}- TabButton {+ Kis.TabButtonBase {text: i18nc("@title:tab", "Paragraph")}- TabButton {+ Kis.TabButtonBase {text: i18nc("@title:tab", "Preset")}}diff --git a/plugins/dockers/textproperties/qml/TextPropertyBase.qml b/plugins/dockers/textproperties/qml/TextPropertyBase.qmlindex da9e64c791..6934231390 100644--- a/plugins/dockers/textproperties/qml/TextPropertyBase.qml+++ b/plugins/dockers/textproperties/qml/TextPropertyBase.qml@@ -63,15 +63,16 @@ Column {enabled = true;}Component.onCompleted: {- children.push(seperator);+ Qt.createQmlObject("import org.krita.components 1.0 as Kis+ Kis.ToolSeparatorBase {+ id: separator;+ orientation: Qt.Horizontal;+ width: parent && typeof parent != 'undefined'? parent.width: 100;+ topPadding: parent.padding;+ }", root)}property Kis.ThemedControl propertyBasePalette: Kis.ThemedControl {}- MenuSeparator {- id: seperator;- width: parent && typeof parent != 'undefined'? parent.width: 100;- topPadding: parent.padding;- }}diff --git a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qmlindex 5f7d691983..d686f82332 100644--- a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml+++ b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml@@ -392,7 +392,7 @@ ColumnLayout {Kis.ToolTipBase {parent: addPropertyDelegate;text: addPropertyDelegate.toolTip;- visible: addPropertyDelegate.highlighted;+ visible: addPropertyDelegate.highlighted && addPropertyCmb.popup.visible;}onClicked: addPropertyCmb.enableProperty(name);diff --git a/qmlmodules/components/CMakeLists.txt b/qmlmodules/components/CMakeLists.txtindex b41b01082c..c43689f5eb 100644--- a/qmlmodules/components/CMakeLists.txt+++ b/qmlmodules/components/CMakeLists.txt@@ -69,6 +69,11 @@ ecm_target_qml_sources(kritaqmlcomponents PRIVATE PATH angleselector SOURCESqml/angleselector/AngleGauge.qml)+ecm_target_qml_sources(kritaqmlcomponents PRIVATE PATH +Fusion SOURCES+ qml/themedComponents/+Fusion/TabButtonBase.qml+ qml/themedComponents/+Fusion/ToolSeparatorBase.qml+)+ecm_target_qml_sources(kritaqmlcomponents SOURCESqml/button/GroupButton.qmlqml/button/OptionButtonStrip.qml@@ -81,7 +86,9 @@ ecm_target_qml_sources(kritaqmlcomponents SOURCESqml/IntSliderSpinBox.qmlqml/DoubleSliderSpinBox.qml- qml/tooltip/ToolTipBase.qml+ qml/themedComponents/ToolTipBase.qml+ qml/themedComponents/TabButtonBase.qml+ qml/themedComponents/ToolSeparatorBase.qmlqml/curvewidget/CurveWidget.qmldiff --git a/qmlmodules/components/qml/themedComponents/+Fusion/TabButtonBase.qml b/qmlmodules/components/qml/themedComponents/+Fusion/TabButtonBase.qmlnew file mode 100644index 0000000000..267d924979--- /dev/null+++ b/qmlmodules/components/qml/themedComponents/+Fusion/TabButtonBase.qml@@ -0,0 +1,43 @@+/*+ * SPDX-FileCopyrightText: 2025 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+import QtQuick 2.15+import QtQuick.Controls 2.15++/*+ By default, Fusion's tabbuttons don't look anything like their QWidgets+ variant. This tries to fix that.+*/+TabButton {+ id: control;+ bottomInset: -10;+ clip: true;+ y: checked ? 0 : 2;++ height: implicitHeight + (checked ? 2 : 0);++ background:Rectangle {+ readonly property bool checked: control.checked;++ color: checked? control.palette.window: Qt.darker(parent.palette.window, 1.1);+ border.color: Qt.darker(parent.palette.window, 1.4);+ radius: 1;+ Rectangle {+ x: 1; y: 1+ width: parent.width - 2+ height: parent.height - 2+ border.color: Qt.lighter(parent.color, 1.3);+ color: parent.color;+ radius: 2;+ }+ Rectangle {+ x: 2; y: 2+ width: parent.width - 4+ height: parent.height;+ color: parent.color;+ radius: 3;+ }+ }+}diff --git a/qmlmodules/components/qml/themedComponents/+Fusion/ToolSeparatorBase.qml b/qmlmodules/components/qml/themedComponents/+Fusion/ToolSeparatorBase.qmlnew file mode 100644index 0000000000..19cafed1fc--- /dev/null+++ b/qmlmodules/components/qml/themedComponents/+Fusion/ToolSeparatorBase.qml@@ -0,0 +1,38 @@+/*+ * SPDX-FileCopyrightText: 2025 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+import QtQuick 2.15+import QtQuick.Controls 2.15++/*+ Fusion's default ToolSeparator has a bug when using the horizontal version,+ the lightened line is not handled properly, so here we fix that.+ */+ToolSeparator {+ id: control++ implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset,+ implicitContentWidth + leftPadding + rightPadding)+ implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset,+ implicitContentHeight + topPadding + bottomPadding)++ padding: vertical ? 6 : 2+ verticalPadding: vertical ? 2 : 6++ contentItem: Rectangle {+ implicitWidth: control.vertical ? 2 : 8+ implicitHeight: control.vertical ? 8 : 2+ color: Qt.darker(control.palette.window, 1.1)++ Rectangle {+ x: control.vertical? 1: 0;+ y: control.vertical? 0: 1;+ width: control.vertical ? 1: parent.width;+ height: control.vertical ? parent.height: 1;+ color: Qt.lighter(control.palette.window, 1.1)+ }+ }++}diff --git a/qmlmodules/components/qml/themedComponents/TabButtonBase.qml b/qmlmodules/components/qml/themedComponents/TabButtonBase.qmlnew file mode 100644index 0000000000..d816d31f24--- /dev/null+++ b/qmlmodules/components/qml/themedComponents/TabButtonBase.qml@@ -0,0 +1,12 @@+/*+ * SPDX-FileCopyrightText: 2025 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+import QtQuick 2.15+import QtQuick.Controls 2.15++// Dummy control to handle the fact that Fusion's tabbutton needs better styling.+TabButton {++}diff --git a/qmlmodules/components/qml/themedComponents/ToolSeparatorBase.qml b/qmlmodules/components/qml/themedComponents/ToolSeparatorBase.qmlnew file mode 100644index 0000000000..9b1799d957--- /dev/null+++ b/qmlmodules/components/qml/themedComponents/ToolSeparatorBase.qml@@ -0,0 +1,13 @@+/*+ * SPDX-FileCopyrightText: 2025 Wolthera van Hövell tot Westerflier <[email protected]>+ *+ * SPDX-License-Identifier: GPL-2.0-or-later+ */+import QtQuick.Controls 2.15++// Dummy because Fusion's tool separator has a bug.+// This will be loaded by non-fusion styles.++ToolSeparator {++}diff --git a/qmlmodules/components/qml/tooltip/ToolTipBase.qml b/qmlmodules/components/qml/themedComponents/ToolTipBase.qmlsimilarity index 100%rename from qmlmodules/components/qml/tooltip/ToolTipBase.qmlrename to qmlmodules/components/qml/themedComponents/ToolTipBase.qmldiff --git a/qmlmodules/widgets/KisQQuickWidget.cpp b/qmlmodules/widgets/KisQQuickWidget.cppindex 840ef37471..acceeb3159 100644--- a/qmlmodules/widgets/KisQQuickWidget.cpp+++ b/qmlmodules/widgets/KisQQuickWidget.cpp@@ -9,6 +9,8 @@#include <QQmlEngine>#include <QQmlContext>#include <QQuickStyle>+#include <QQmlFileSelector>+#include <QFileSelector>#include <KLocalizedContext>@@ -54,6 +56,15 @@ KisQQuickWidget::KisQQuickWidget(QWidget *parent): QQuickWidget(parent)engine()->addPluginPath(KoResourcePaths::getApplicationRoot() + "/lib/qml/");engine()->addPluginPath(KoResourcePaths::getApplicationRoot() + "/lib64/qml/");+ QQmlFileSelector* selector = new QQmlFileSelector(engine());+ QStringList extraSelectors;+ /*+ * This allows for Style specific components, which it'll load from+ * a "+StyleName" folder.+ */+ extraSelectors << QQuickStyle::name();+ selector->setExtraSelectors(extraSelectors);+setResizeMode(QQuickWidget::SizeRootObjectToView);}