From b532fd2f2087ffaee65258a4f04c05970670077c Mon Sep 17 00:00:00 2001 From: Nate Graham Date: Thu, 24 Sep 2020 12:46:56 -0600 Subject: [PATCH] Make PlasmaComponents3 Tooltips use the typical tooltip style Without this, the tooltips are light when using a light theme. This is contrary to other tooltips, which are always dark no matter which coloration of theme you're using. BUG: 424506 FIXED-IN: 5.75 --- .../plasmacomponents3/ToolTip.qml | 44 ++++++++++++++----- 1 file changed, 33 insertions(+), 11 deletions(-) diff --git a/src/declarativeimports/plasmacomponents3/ToolTip.qml b/src/declarativeimports/plasmacomponents3/ToolTip.qml index 267f02c9b..15dd975c7 100644 --- a/src/declarativeimports/plasmacomponents3/ToolTip.qml +++ b/src/declarativeimports/plasmacomponents3/ToolTip.qml @@ -20,14 +20,14 @@ T.ToolTip { delay: Kirigami.Units.toolTipDelay timeout: 5000 - implicitWidth: contentItem.implicitWidth + leftPadding + rightPadding - implicitHeight: contentItem.implicitHeight + topPadding + bottomPadding + implicitHeight: Math.max(implicitBackgroundHeight + topInset + bottomInset, implicitContentHeight + topPadding + bottomPadding) + implicitWidth: Math.max(implicitBackgroundWidth + leftInset + rightInset, implicitContentWidth + leftPadding + rightPadding) margins: units.gridUnit - leftPadding: background.margins.left - topPadding: background.margins.top - rightPadding: background.margins.right - bottomPadding: background.margins.bottom + leftPadding: backgroundItem.margins.left + topPadding: backgroundItem.margins.top + rightPadding: backgroundItem.margins.right + bottomPadding: backgroundItem.margins.bottom closePolicy: T.Popup.CloseOnEscape | T.Popup.CloseOnPressOutsideParent | T.Popup.CloseOnReleaseOutsideParent @@ -36,12 +36,34 @@ T.ToolTip { // those used to determine the alt key shortcut text: control.text.replace(/&(?=\S)/g, "") font: control.font - color: PlasmaCore.ColorScope.textColor + PlasmaCore.ColorScope.colorGroup: PlasmaCore.Theme.ToolTipColorGroup + PlasmaCore.ColorScope.inherit: false } - background: PlasmaCore.FrameSvgItem { - height: Math.max(implicitHeight, control.height) - width: Math.max(implicitWidth, control.width) - imagePath: "widgets/background" + background: Item { + implicitHeight: PlasmaCore.Units.gridUnit + backgroundItem.margins.top + backgroundItem.margins.bottom + implicitWidth: PlasmaCore.Units.gridUnit + backgroundItem.margins.left + backgroundItem.margins.right + + PlasmaCore.FrameSvgItem { + anchors.fill: parent + anchors.leftMargin: -margins.left + anchors.rightMargin: -margins.right + anchors.topMargin: -margins.top + anchors.bottomMargin: -margins.bottom + imagePath: "widgets/tooltip" + prefix: "shadow" + colorGroup: PlasmaCore.Theme.ToolTipColorGroup + PlasmaCore.ColorScope.inherit: false + } + + PlasmaCore.FrameSvgItem { + id: backgroundItem + anchors.fill: parent + // Because the transparent one doesn't match the appearance of all + // other ones + imagePath: "opaque/widgets/tooltip" + colorGroup: PlasmaCore.Theme.ToolTipColorGroup + PlasmaCore.ColorScope.inherit: false + } } }