Make hover actions position logic more robust

This commit is contained in:
Carl Schwan
2024-09-20 18:03:11 +02:00
parent 2969d20a92
commit 485e0f0510

View File

@@ -44,8 +44,6 @@ QQC2.Control {
leftPadding: 0 leftPadding: 0
rightPadding: 0 rightPadding: 0
width: delegate ? delegate.bubbleWidth : Kirigami.Units.gridUnit * 4
visible: (root.hovered || root.showActions || showActionsTimer.running) && !Kirigami.Settings.isMobile visible: (root.hovered || root.showActions || showActionsTimer.running) && !Kirigami.Settings.isMobile
onVisibleChanged: { onVisibleChanged: {
if (visible) { if (visible) {
@@ -59,16 +57,19 @@ QQC2.Control {
interval: 200 interval: 200
} }
function updatePosition() { function updatePosition(): void {
if (delegate) { if (delegate) {
root.x = delegate.contentItem.x + delegate.bubbleX; root.x = delegate.contentItem.x + delegate.bubbleX + delegate.bubbleWidth - root.implicitWidth;
root.y = delegate.mapToItem(parent, 0, 0).y + delegate.bubbleY - height + Kirigami.Units.smallSpacing; root.y = delegate.mapToItem(parent, 0, 0).y + delegate.bubbleY - height + Kirigami.Units.smallSpacing;
} }
} }
onDelegateChanged: updatePosition() onDelegateChanged: updatePosition()
onWidthChanged: updatePosition()
contentItem: RowLayout { contentItem: RowLayout {
id: actionsLayout
spacing: Kirigami.Units.smallSpacing spacing: Kirigami.Units.smallSpacing
Item { Item {