Files
mxandClaude Opus 5.5 d6a6cf69f4 Style in-window tooltips as glass instead of the stock Basic look
Dock items, the launcher mode button and the settings hints used the attached
ToolTip, which only gets the Basic style. GlassToolTip wraps ToolTip with a
GlassPanel background, theme text and a Theme.duration fade, matching the
bar's tooltip popout.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 23:50:24 +02:00

142 lines
5.2 KiB
QML

import QtQuick
import "../components"
import "../services"
import "../theme"
Item {
id: root
required property var modelData
required property int index
required property var dockWindow
readonly property var group: DockModel.find(modelData.id) || modelData
readonly property bool vertical: dockWindow.vertical
readonly property var options: DockModel.options
readonly property real influence: Theme.intensity > 0 && options.magnification && dockWindow.hoveredIndex >= 0 && !DockState.draggingId ? Math.max(0, 1 - Math.abs(index - dockWindow.hoveredIndex) / 2.5) : 0
readonly property real magnification: 1 + options.magnificationStrength * influence * Theme.intensity
property bool dragging: false
property point pressedAt
property real offsetX: 0
property real offsetY: 0
width: vertical ? dockWindow.thickness - 20 : options.iconSize + 12 + options.iconSize * influence * 0.2
height: vertical ? options.iconSize + 12 + options.iconSize * influence * 0.2 : dockWindow.thickness - 20
Behavior on width {
NumberAnimation {
duration: root.dockWindow.motionDuration
}
}
Behavior on height {
NumberAnimation {
duration: root.dockWindow.motionDuration
}
}
Component.onCompleted: DockState.icons = DockState.icons.concat([root])
Component.onDestruction: DockState.removeIcon(root)
Item {
id: visual
anchors.centerIn: parent
width: root.options.iconSize
height: width
scale: mouse.pressed && !root.dragging ? 1 - 0.08 * Theme.intensity : root.magnification
transform: Translate {
x: root.offsetX
y: root.offsetY
}
Behavior on scale {
NumberAnimation {
duration: root.dockWindow.motionDuration
easing.type: Easing.OutCubic
}
}
Image {
id: icon
anchors.fill: parent
source: ApplicationsService.icon(root.group.entry)
sourceSize.width: root.options.iconSize * 2
sourceSize.height: root.options.iconSize * 2
fillMode: Image.PreserveAspectFit
}
Rectangle {
anchors.fill: parent
radius: 12
color: Theme.surfaceVariant
visible: icon.source.toString() === "" || icon.status === Image.Error
Text {
anchors.centerIn: parent
text: root.group.name.slice(0, 2).toUpperCase()
color: Theme.text
font.pixelSize: 16
}
}
}
Rectangle {
width: root.group.focused ? 15 : 5
height: 4
radius: 2
x: root.vertical ? (root.options.position === "left" ? 3 : root.width - width - 3) : (root.width - width) / 2
y: root.vertical ? (root.height - height) / 2 : root.height - height - 3
color: root.group.focused ? Theme.accent : Theme.textSecondary
visible: root.options.runningIndicators && root.group.windows.length > 0
Behavior on width {
NumberAnimation {
duration: root.dockWindow.motionDuration
}
}
}
MouseArea {
id: mouse
anchors.fill: parent
hoverEnabled: true
acceptedButtons: Qt.LeftButton | Qt.RightButton
preventStealing: root.group.pinned
onEntered: root.dockWindow.hoveredIndex = root.index
onExited: if (!pressed)
root.dockWindow.hoveredIndex = -1
onPressed: event => {
root.pressedAt = Qt.point(event.x, event.y);
root.dragging = false;
}
onPositionChanged: event => {
if (!pressed || pressedButtons !== Qt.LeftButton || !root.group.pinned)
return;
const dx = event.x - root.pressedAt.x, dy = event.y - root.pressedAt.y;
if (root.dragging || Math.hypot(dx, dy) > 8) {
root.dragging = true;
DockState.draggingId = root.group.id;
root.offsetX = dx;
root.offsetY = dy;
}
}
onReleased: event => {
if (root.dragging)
root.dockWindow.dropPin(root, event.x, event.y);
root.offsetX = 0;
root.offsetY = 0;
DockState.draggingId = "";
}
onCanceled: {
root.offsetX = 0;
root.offsetY = 0;
root.dragging = false;
DockState.draggingId = "";
}
onClicked: event => {
if (root.dragging) {
root.dragging = false;
return;
}
if (event.button === Qt.RightButton)
DockState.open(root.group.id, root, false);
else
DockState.click(root.group.id, root);
}
}
Accessible.role: Accessible.Button
Accessible.name: group.name
Accessible.onPressAction: DockState.click(group.id, root)
GlassToolTip {
visible: root.options.tooltips && mouse.containsMouse && !DockState.opened && !root.dragging
delay: 500
text: root.group.name + (root.group.windows.length ? " · " + root.group.windows.length + " window(s)" : root.group.entry ? "" : " · unavailable")
}
}