mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-06-28 14:05:21 -04:00
38 lines
966 B
QML
38 lines
966 B
QML
pragma ComponentBehavior: Bound
|
|
|
|
import QtQuick
|
|
|
|
Item {
|
|
id: root
|
|
|
|
property bool enabled: false
|
|
property var shouldDismiss: null
|
|
|
|
signal dismissRequested
|
|
// Emitted on every hover move; passive to avoid blocking overlapping MouseAreas
|
|
signal hoverMoved(real gx, real gy)
|
|
|
|
anchors.fill: parent
|
|
|
|
HoverHandler {
|
|
id: hoverHandler
|
|
enabled: root.enabled
|
|
onPointChanged: {
|
|
if (!root.enabled || !hoverHandler.hovered)
|
|
return;
|
|
const gp = root.mapToItem(null, hoverHandler.point.position.x, hoverHandler.point.position.y);
|
|
root.hoverMoved(gp.x, gp.y);
|
|
}
|
|
onHoveredChanged: {
|
|
if (hoverHandler.hovered || !root.enabled)
|
|
return;
|
|
if (typeof root.shouldDismiss === "function" && !root.shouldDismiss())
|
|
return;
|
|
root.dismissRequested();
|
|
}
|
|
}
|
|
|
|
function cancelPending() {
|
|
}
|
|
}
|