Skip to content

armgit / krita

Public Imported from GitHub
0

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++

Replace uses of ToolTip with dedicated ToolTipBase and more theming tweaks.

Wolthera van Hövell tot Westerflier7e3026409a9d
diff --git a/plugins/dockers/textproperties/qml/FontResourceDropdown.qml b/plugins/dockers/textproperties/qml/FontResourceDropdown.qml
index a76fadbefe..76968bcd20 100644
--- a/plugins/dockers/textproperties/qml/FontResourceDropdown.qml
+++ b/plugins/dockers/textproperties/qml/FontResourceDropdown.qml
@@ -304,6 +304,7 @@ Button {
}
MouseArea {
+ id: delegateMouseArea;
acceptedButtons: Qt.RightButton | Qt.LeftButton;
anchors.fill: parent;
hoverEnabled: true;
@@ -323,9 +324,10 @@ Button {
}
}
- ToolTip.text: fontDelegateItem.fontName;
- ToolTip.visible: containsMouse;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
+ Kis.ToolTipBase {
+ text: fontDelegateItem.fontName;
+ visible: delegateMouseArea.containsMouse;
+ }
}
}
}
@@ -335,7 +337,7 @@ Button {
id: familyCmbPopup;
y: familyCmb.height - 1;
x: familyCmb.width - width;
- width: Math.max(contentWidth, familyCmb.width);
+ width: Math.max(contentWidth, Math.max(familyCmb.width, 200));
height: Math.min(contentItem.implicitHeight, familyCmb.maxPopupHeight - topMargin - bottomMargin)
padding: 2;
diff --git a/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml b/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml
index 2d183bdf31..0cb3ea60ed 100644
--- a/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml
+++ b/plugins/dockers/textproperties/qml/OpenTypeFeatureDelegate.qml
@@ -15,10 +15,10 @@ Control {
height: implicitHeight;
implicitHeight: layout.height + padding*2;
clip: true;
- property string display;
- property string tag;
- property string sample;
- property string toolTip;
+ required property string display;
+ required property string tag;
+ required property string sample;
+ required property string toolTip;
property int featureValue: 0;
onFeatureValueChanged: svgTextLabel.updateFeatureValue();
@@ -113,9 +113,11 @@ Control {
hoverEnabled: root.enableMouseEvents;
enabled: root.enableMouseEvents;
onClicked: (mouse)=>{ featureClicked(mouse); }
-
- ToolTip.text: root.toolTip;
- ToolTip.visible: containsMouse;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
+ Kis.ToolTipBase {
+ parent: mouseArea;
+ text: root.toolTip;
+ visible: mouseArea.containsMouse;
+ }
}
+
}
diff --git a/plugins/dockers/textproperties/qml/SqueezedComboBox.qml b/plugins/dockers/textproperties/qml/SqueezedComboBox.qml
index 3426593874..1e40af8a5d 100644
--- a/plugins/dockers/textproperties/qml/SqueezedComboBox.qml
+++ b/plugins/dockers/textproperties/qml/SqueezedComboBox.qml
@@ -36,9 +36,11 @@ ComboBox {
background: Rectangle{ color:"transparent";}
- ToolTip.text: tooltipText;
- ToolTip.visible: highlighted && tooltipText.length > 0;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
+ Kis.ToolTipBase {
+ parent: contentItemDelegate
+ visible: contentItemDelegate.hovered && contentItemDelegate.tooltipText.length > 0;
+ text: contentItemDelegate.tooltipText;
+ }
onClicked: {
squeezedComboBox.popup.visible? squeezedComboBox.popup.close(): squeezedComboBox.popup.open();
}
@@ -84,9 +86,11 @@ ComboBox {
font: squeezedComboDelegate.font;
}
- ToolTip.text: tooltipText;
- ToolTip.visible: highlighted && tooltipText.length > 0;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
+ Kis.ToolTipBase {
+ parent: squeezedComboDelegate;
+ visible: highlighted && squeezedComboDelegate.tooltipText.length > 0;
+ text: squeezedComboDelegate.tooltipText;
+ }
}
popup.palette: squeezedComboBox.palette;
diff --git a/plugins/dockers/textproperties/qml/TextProperties.qml b/plugins/dockers/textproperties/qml/TextProperties.qml
index e6d74e16c1..513ad2eb9f 100644
--- a/plugins/dockers/textproperties/qml/TextProperties.qml
+++ b/plugins/dockers/textproperties/qml/TextProperties.qml
@@ -198,9 +198,10 @@ Control {
}
readonly property string missingFontName : i18nc("%1 is name of a font family", "Font Family \"%1\" is missing on this machine. This style preset may not work correctly.", presetDelegate.meta.primary_font_family);
- ToolTip.text: (typeof presetDelegate.meta.description !== 'undefined'? presetDelegate.model.name + "\n" + presetDelegate.meta.description: presetDelegate.model.name) + (missingFamily.visible? "\n"+ missingFontName: "");
- ToolTip.visible: containsMouse;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval;
+ Kis.ToolTipBase {
+ text: (typeof presetDelegate.meta.description !== 'undefined'? presetDelegate.model.name + "\n" + presetDelegate.meta.description: presetDelegate.model.name) + (missingFamily.visible? "\n"+ delegateMouseArea.missingFontName: "");
+ visible: delegateMouseArea.containsMouse;
+ }
}
}
diff --git a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml
index a9de10ea99..5f7d691983 100644
--- a/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml
+++ b/plugins/dockers/textproperties/qml/TextPropertyBaseList.qml
@@ -389,9 +389,11 @@ ColumnLayout {
highlighted: addPropertyCmb.highlightedIndex === index;
background: Rectangle { color: highlighted? parent.palette.highlight:"transparent"; }
- ToolTip.text: toolTip;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
- ToolTip.visible: highlighted;
+ Kis.ToolTipBase {
+ parent: addPropertyDelegate;
+ text: addPropertyDelegate.toolTip;
+ visible: addPropertyDelegate.highlighted;
+ }
onClicked: addPropertyCmb.enableProperty(name);
}
@@ -407,9 +409,11 @@ ColumnLayout {
icon.height: 16;
text: i18nc("@label:button", "Configure");
display: AbstractButton.IconOnly;
- ToolTip.text: text;
- ToolTip.delay: Qt.styleHints.mousePressAndHoldInterval
- ToolTip.visible: highlighted;
+
+ Kis.ToolTipBase {
+ text: configButton.text;
+ visible: configButton.highlighted;
+ }
palette: paletteControl.palette;
diff --git a/qmlmodules/components/CMakeLists.txt b/qmlmodules/components/CMakeLists.txt
index e24fe7f2dc..b41b01082c 100644
--- a/qmlmodules/components/CMakeLists.txt
+++ b/qmlmodules/components/CMakeLists.txt
@@ -81,7 +81,7 @@ ecm_target_qml_sources(kritaqmlcomponents SOURCES
qml/IntSliderSpinBox.qml
qml/DoubleSliderSpinBox.qml
- qml/tooltip/KisToolTip.qml
+ qml/tooltip/ToolTipBase.qml
qml/curvewidget/CurveWidget.qml
diff --git a/qmlmodules/components/qml/button/GroupButton.qml b/qmlmodules/components/qml/button/GroupButton.qml
index 9340b29eb4..c0e1275a7d 100644
--- a/qmlmodules/components/qml/button/GroupButton.qml
+++ b/qmlmodules/components/qml/button/GroupButton.qml
@@ -61,7 +61,7 @@ Button {
Kis.Theme {
id: theme;
- button.state: root.enabled? root.activeFocus? SystemPalette.Active: SystemPalette.Inactive: SystemPalette.Disabled;
+ button.state: root.enabled? SystemPalette.Active: SystemPalette.Disabled;
}
/*
@@ -73,6 +73,12 @@ Button {
property int groupPosition: GroupButton.GroupPosition.NoGroup;
palette.button: checked? theme.selection.backgroundColor: theme.button.backgroundColor;
palette.buttonText: checked? theme.selection.textColor: theme.button.textColor;
+ palette.light: checked? theme.selection.lightShadeColor: theme.button.lightShadeColor;
+ palette.midlight: checked? theme.selection.midLightShadeColor: theme.button.midLightShadeColor;
+ palette.mid: checked? theme.selection.midShadeColor: theme.button.midShadeColor;
+ palette.dark: checked? theme.selection.darkShadeColor: theme.button.darkShadeColor;
+ palette.shadow: checked? theme.selection.shadowShadeColor: theme.button.shadowShadeColor;
+ palette.window: theme.window.backgroundColor;
text: "Button"
clip: true
diff --git a/qmlmodules/components/qml/sliderspinbox/SliderSpinBoxRangeSwitch.qml b/qmlmodules/components/qml/sliderspinbox/SliderSpinBoxRangeSwitch.qml
index e00465a4ef..5db206d7bc 100644
--- a/qmlmodules/components/qml/sliderspinbox/SliderSpinBoxRangeSwitch.qml
+++ b/qmlmodules/components/qml/sliderspinbox/SliderSpinBoxRangeSwitch.qml
@@ -4,7 +4,7 @@
* SPDX-License-Identifier: GPL-2.0-or-later
*/
import QtQuick 2.15
-import org.krita.components 1.0
+import org.krita.components 1.0 as Kis
/*
\qmltype SliderSpinBoxRangeSwitch
@@ -133,7 +133,7 @@ Item {
onClicked: root.softRangeActive = !root.softRangeActive
}
- KisToolTip {
+ Kis.ToolTipBase {
id: toolTipPopup
parent: root
visible: root.enabled && mouseArea.containsMouse
diff --git a/qmlmodules/components/qml/tooltip/KisToolTip.qml b/qmlmodules/components/qml/tooltip/ToolTipBase.qml
similarity index 65%
rename from qmlmodules/components/qml/tooltip/KisToolTip.qml
rename to qmlmodules/components/qml/tooltip/ToolTipBase.qml
index e6323ee1e3..650228f853 100644
--- a/qmlmodules/components/qml/tooltip/KisToolTip.qml
+++ b/qmlmodules/components/qml/tooltip/ToolTipBase.qml
@@ -5,6 +5,7 @@
*/
import QtQuick 2.15
import QtQuick.Controls 2.15
+import org.krita.components 1.0 as Kis
ToolTip {
id: root
@@ -25,6 +26,21 @@ ToolTip {
}
}
+ Kis.Theme {
+ id: theme;
+ }
+
+ palette.toolTipBase: theme.tooltip.backgroundColor;
+ palette.toolTipText: theme.tooltip.textColor;
+ palette.link: theme.tooltip.linkTextColor;
+ palette.linkVisited: theme.tooltip.linkVisitedColor;
+
+ palette.light: theme.tooltip.lightShadeColor;
+ palette.midlight: theme.tooltip.midLightShadeColor;
+ palette.mid: theme.tooltip.midShadeColor;
+ palette.dark: theme.tooltip.darkShadeColor;
+ palette.shadow: theme.tooltip.shadowShadeColor;
+
onParentControlChanged: {
changingParentControl = true;
if (root.parentControl) {