add accentColor property to BarIcon and BarLabel for proper color propagation
This commit is contained in:
parent
b3e919514a
commit
7dbbb89455
4 changed files with 8 additions and 6 deletions
|
|
@ -7,6 +7,7 @@ Text {
|
||||||
property string icon: ""
|
property string icon: ""
|
||||||
property string tooltip: ""
|
property string tooltip: ""
|
||||||
property string minIcon: ""
|
property string minIcon: ""
|
||||||
|
property color accentColor: parent?.accentColor ?? M.Theme.base05
|
||||||
property bool _hovered: false
|
property bool _hovered: false
|
||||||
property string _displayIcon: icon
|
property string _displayIcon: icon
|
||||||
property string _pendingIcon: ""
|
property string _pendingIcon: ""
|
||||||
|
|
@ -41,7 +42,7 @@ Text {
|
||||||
}
|
}
|
||||||
width: minIcon ? Math.max(implicitWidth, _minIconMetrics.width) : implicitWidth
|
width: minIcon ? Math.max(implicitWidth, _minIconMetrics.width) : implicitWidth
|
||||||
horizontalAlignment: minIcon ? Text.AlignHCenter : Text.AlignLeft
|
horizontalAlignment: minIcon ? Text.AlignHCenter : Text.AlignLeft
|
||||||
color: parent?.accentColor ?? M.Theme.base05
|
color: root.accentColor
|
||||||
font.pixelSize: M.Theme.fontSize + 1
|
font.pixelSize: M.Theme.fontSize + 1
|
||||||
font.family: M.Theme.iconFontFamily
|
font.family: M.Theme.iconFontFamily
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
@ -60,7 +61,7 @@ Text {
|
||||||
M.FlyoutState.text = root.tooltip;
|
M.FlyoutState.text = root.tooltip;
|
||||||
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0);
|
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0);
|
||||||
M.FlyoutState.screen = QsWindow.window?.screen ?? null;
|
M.FlyoutState.screen = QsWindow.window?.screen ?? null;
|
||||||
M.FlyoutState.accentColor = parent?.accentColor ?? root.color;
|
M.FlyoutState.accentColor = root.accentColor;
|
||||||
M.FlyoutState.visible = true;
|
M.FlyoutState.visible = true;
|
||||||
} else if (!hovered && root.tooltip !== "") {
|
} else if (!hovered && root.tooltip !== "") {
|
||||||
M.FlyoutState.visible = false;
|
M.FlyoutState.visible = false;
|
||||||
|
|
|
||||||
|
|
@ -7,12 +7,13 @@ Text {
|
||||||
property string label: ""
|
property string label: ""
|
||||||
property string tooltip: ""
|
property string tooltip: ""
|
||||||
property string minText: ""
|
property string minText: ""
|
||||||
|
property color accentColor: parent?.accentColor ?? M.Theme.base05
|
||||||
property bool _hovered: false
|
property bool _hovered: false
|
||||||
|
|
||||||
text: label
|
text: label
|
||||||
width: minText ? Math.max(implicitWidth, _minMetrics.width) : implicitWidth
|
width: minText ? Math.max(implicitWidth, _minMetrics.width) : implicitWidth
|
||||||
horizontalAlignment: minText ? Text.AlignHCenter : Text.AlignLeft
|
horizontalAlignment: minText ? Text.AlignHCenter : Text.AlignLeft
|
||||||
color: parent?.accentColor ?? M.Theme.base05
|
color: root.accentColor
|
||||||
font.pixelSize: M.Theme.fontSize
|
font.pixelSize: M.Theme.fontSize
|
||||||
font.family: M.Theme.fontFamily
|
font.family: M.Theme.fontFamily
|
||||||
verticalAlignment: Text.AlignVCenter
|
verticalAlignment: Text.AlignVCenter
|
||||||
|
|
@ -31,7 +32,7 @@ Text {
|
||||||
M.FlyoutState.text = root.tooltip;
|
M.FlyoutState.text = root.tooltip;
|
||||||
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0);
|
M.FlyoutState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0);
|
||||||
M.FlyoutState.screen = QsWindow.window?.screen ?? null;
|
M.FlyoutState.screen = QsWindow.window?.screen ?? null;
|
||||||
M.FlyoutState.accentColor = parent?.accentColor ?? root.color;
|
M.FlyoutState.accentColor = root.accentColor;
|
||||||
M.FlyoutState.visible = true;
|
M.FlyoutState.visible = true;
|
||||||
} else if (!hovered && root.tooltip !== "") {
|
} else if (!hovered && root.tooltip !== "") {
|
||||||
M.FlyoutState.visible = false;
|
M.FlyoutState.visible = false;
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ import "." as M
|
||||||
|
|
||||||
M.BarIcon {
|
M.BarIcon {
|
||||||
id: root
|
id: root
|
||||||
color: root.active ? M.Theme.base09 : (parent?.accentColor ?? M.Theme.base05)
|
color: root.active ? M.Theme.base09 : root.accentColor
|
||||||
tooltip: {
|
tooltip: {
|
||||||
const parts = ["Idle inhibition: " + (root.active ? "active" : "inactive")];
|
const parts = ["Idle inhibition: " + (root.active ? "active" : "inactive")];
|
||||||
if (root._inhibitors)
|
if (root._inhibitors)
|
||||||
|
|
|
||||||
|
|
@ -5,7 +5,7 @@ M.BarIcon {
|
||||||
id: root
|
id: root
|
||||||
tooltip: "Power profile: " + (M.PowerProfileService.profile || "unknown")
|
tooltip: "Power profile: " + (M.PowerProfileService.profile || "unknown")
|
||||||
|
|
||||||
color: M.PowerProfileService.profile === "performance" ? M.Theme.base09 : M.PowerProfileService.profile === "power-saver" ? M.Theme.base0B : parent?.accentColor ?? M.Theme.base05
|
color: M.PowerProfileService.profile === "performance" ? M.Theme.base09 : M.PowerProfileService.profile === "power-saver" ? M.Theme.base0B : root.accentColor
|
||||||
|
|
||||||
icon: {
|
icon: {
|
||||||
if (M.PowerProfileService.profile === "performance")
|
if (M.PowerProfileService.profile === "performance")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue