flyout tooltips
This commit is contained in:
parent
e3ba80fd0d
commit
99f71f858d
8 changed files with 113 additions and 39 deletions
|
|
@ -1,8 +1,9 @@
|
|||
import QtQuick
|
||||
import QtQuick.Controls
|
||||
import Quickshell
|
||||
import "." as M
|
||||
|
||||
Text {
|
||||
id: root
|
||||
property string label: ""
|
||||
property string tooltip: ""
|
||||
|
||||
|
|
@ -12,9 +13,17 @@ Text {
|
|||
font.family: M.Theme.fontFamily
|
||||
verticalAlignment: Text.AlignVCenter
|
||||
|
||||
HoverHandler { id: _hover }
|
||||
M.BarTooltip {
|
||||
visible: _hover.hovered && parent.tooltip !== ""
|
||||
text: parent.tooltip
|
||||
HoverHandler {
|
||||
onHoveredChanged: {
|
||||
if (hovered && root.tooltip !== "") {
|
||||
const win = QsWindow.window
|
||||
M.FlyoutState.text = root.tooltip
|
||||
M.FlyoutState.itemX = root.mapToItem(win, root.width / 2, 0).x
|
||||
M.FlyoutState.screen = win?.screen ?? null
|
||||
M.FlyoutState.visible = true
|
||||
} else if (!hovered && root.tooltip !== "") {
|
||||
M.FlyoutState.visible = false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue