refactor: unified BarModule base component, click-to-open panels, remove pinning
This commit is contained in:
parent
034f0b6d85
commit
26476dc930
33 changed files with 273 additions and 517 deletions
|
|
@ -1,15 +1,13 @@
|
|||
import QtQuick
|
||||
import Quickshell
|
||||
import "." as M
|
||||
import "../services" as S
|
||||
|
||||
// Label element with minimum-width support via minText.
|
||||
// Pure visual component - tooltip handling lives in the parent BarModule.
|
||||
Text {
|
||||
id: root
|
||||
property string label: ""
|
||||
property string tooltip: ""
|
||||
property string minText: ""
|
||||
property color accentColor: parent?.accentColor ?? S.Theme.base05
|
||||
property bool _hovered: false
|
||||
|
||||
text: label
|
||||
width: minText ? Math.max(implicitWidth, _minMetrics.width) : implicitWidth
|
||||
|
|
@ -25,23 +23,4 @@ Text {
|
|||
font.pixelSize: root.font.pixelSize
|
||||
font.family: root.font.family
|
||||
}
|
||||
|
||||
HoverHandler {
|
||||
cursorShape: Qt.PointingHandCursor
|
||||
onHoveredChanged: {
|
||||
root._hovered = hovered;
|
||||
if (hovered && root.tooltip !== "") {
|
||||
M.TooltipState.text = root.tooltip;
|
||||
M.TooltipState.itemX = root.mapToGlobal(root.width / 2, 0).x - (QsWindow.window?.screen?.x ?? 0);
|
||||
M.TooltipState.screen = QsWindow.window?.screen ?? null;
|
||||
M.TooltipState.accentColor = root.accentColor;
|
||||
M.TooltipState.visible = true;
|
||||
} else if (!hovered && root.tooltip !== "") {
|
||||
M.TooltipState.visible = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onTooltipChanged: if (_hovered && tooltip !== "")
|
||||
M.TooltipState.text = tooltip
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue