tray icons: hover glow
This commit is contained in:
parent
55ab5bc4e7
commit
87be2c720a
1 changed files with 5 additions and 3 deletions
|
|
@ -21,6 +21,7 @@ RowLayout {
|
||||||
required property SystemTrayItem modelData
|
required property SystemTrayItem modelData
|
||||||
|
|
||||||
readonly property bool _needsAttention: modelData.status === SystemTrayItemStatus.NeedsAttention
|
readonly property bool _needsAttention: modelData.status === SystemTrayItemStatus.NeedsAttention
|
||||||
|
property bool _hovered: false
|
||||||
property real _pulseOpacity: 1
|
property real _pulseOpacity: 1
|
||||||
|
|
||||||
implicitWidth: 18
|
implicitWidth: 18
|
||||||
|
|
@ -38,11 +39,11 @@ RowLayout {
|
||||||
anchors.fill: parent
|
anchors.fill: parent
|
||||||
opacity: iconItem._pulseOpacity
|
opacity: iconItem._pulseOpacity
|
||||||
|
|
||||||
layer.enabled: iconItem._needsAttention
|
layer.enabled: iconItem._needsAttention || iconItem._hovered
|
||||||
layer.effect: MultiEffect {
|
layer.effect: MultiEffect {
|
||||||
shadowEnabled: true
|
shadowEnabled: true
|
||||||
shadowColor: M.Theme.base08
|
shadowColor: iconItem._needsAttention ? M.Theme.base08 : M.Theme.base05
|
||||||
shadowBlur: 0.8
|
shadowBlur: iconItem._needsAttention ? 0.8 : 0.5
|
||||||
shadowVerticalOffset: 0
|
shadowVerticalOffset: 0
|
||||||
shadowHorizontalOffset: 0
|
shadowHorizontalOffset: 0
|
||||||
}
|
}
|
||||||
|
|
@ -56,6 +57,7 @@ RowLayout {
|
||||||
|
|
||||||
HoverHandler {
|
HoverHandler {
|
||||||
onHoveredChanged: {
|
onHoveredChanged: {
|
||||||
|
iconItem._hovered = hovered;
|
||||||
const tip = [iconItem.modelData.tooltipTitle, iconItem.modelData.tooltipDescription].filter(s => s).join("\n") || iconItem.modelData.title;
|
const tip = [iconItem.modelData.tooltipTitle, iconItem.modelData.tooltipDescription].filter(s => s).join("\n") || iconItem.modelData.title;
|
||||||
if (hovered && tip) {
|
if (hovered && tip) {
|
||||||
M.FlyoutState.text = tip;
|
M.FlyoutState.text = tip;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue