[PC3 ToolButton] Have the label take into account complementary color schemes
Summary: We've ported the SDDM theme to PC3 and now have black labels in PC3 ToolButtons (keyboard and session button). The SDDM theme uses a complementary color scheme, which is something the PC2 ToolButton respects and turns the labels white. Therefore I just copy pasted PC2's label color code to its PC3 counterpart. BUG: 414929 FIXED-IN: 5.66 Test Plan: ``` import QtQuick 2.13 import org.kde.plasma.components 3.0 as PlasmaComponents import org.kde.plasma.core 2.0 as PlasmaCore PlasmaCore.ColorScope { colorGroup: PlasmaCore.Theme.ComplementaryColorGroup Rectangle { height: 80 width: 100 color: "red" PlasmaComponents.ToolButton{ anchors.fill: parent text: "sup" } } } ``` The label was white instead of black. Reviewers: #plasma, ngraham, davidedmundson Reviewed By: #plasma, ngraham, davidedmundson Subscribers: mart, davidedmundson, fvogt, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D25699
This commit is contained in:
parent
a3acfbfce6
commit
e4e1613b0f
@ -56,13 +56,20 @@ T.ToolButton {
|
|||||||
colorGroup: PlasmaCore.ColorScope.colorGroup
|
colorGroup: PlasmaCore.ColorScope.colorGroup
|
||||||
source: control.icon ? (control.icon.name || control.icon.source) : ""
|
source: control.icon ? (control.icon.name || control.icon.source) : ""
|
||||||
}
|
}
|
||||||
|
//NOTE: this is used only to check element's existence
|
||||||
|
PlasmaCore.FrameSvgItem {
|
||||||
|
id: buttonsurfaceChecker
|
||||||
|
visible: false
|
||||||
|
imagePath: "widgets/button"
|
||||||
|
prefix: control.flat ? ["toolbutton-hover", "normal"] : "normal"
|
||||||
|
}
|
||||||
Label {
|
Label {
|
||||||
Layout.fillWidth: true
|
Layout.fillWidth: true
|
||||||
visible: text.length > 0
|
visible: text.length > 0
|
||||||
text: control.Kirigami.MnemonicData.richTextLabel
|
text: control.Kirigami.MnemonicData.richTextLabel
|
||||||
font: control.font
|
font: control.font
|
||||||
opacity: enabled || control.highlighted || control.checked ? 1 : 0.4
|
opacity: enabled || control.highlighted || control.checked ? 1 : 0.4
|
||||||
color: theme.buttonTextColor
|
color: (control.hovered || !control.flat) && buttonsurfaceChecker.usedPrefix != "toolbutton-hover" ? theme.buttonTextColor : PlasmaCore.ColorScope.textColor
|
||||||
horizontalAlignment: Text.AlignHCenter
|
horizontalAlignment: Text.AlignHCenter
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
elide: Text.ElideRight
|
elide: Text.ElideRight
|
||||||
|
Loading…
Reference in New Issue
Block a user