From 66f83ebf9e70e637aa69bb6865670829a6ba73b9 Mon Sep 17 00:00:00 2001 From: Casper Jeukendrup <48658420+cbjeukendrup@users.noreply.github.com> Date: Thu, 7 May 2026 22:52:44 +0200 Subject: [PATCH] MenuView: fix x/y properties MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Don’t override them immediately after setting them, in `updateGeometry`. Instead, set them in QML, and only when no explicit value for them is requested, hoping that this preserve the intention of the removed code (I must admit I’m not 100% sure what the intention was). Also remove seemingly redundant calls to `updateGeometry` (but removing just those calls does not solve the problem). --- .../uicomponents/qml/Muse/UiComponents/StyledMenuLoader.qml | 4 ++++ framework/uicomponents/qml/Muse/UiComponents/menuview.cpp | 6 ------ 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/framework/uicomponents/qml/Muse/UiComponents/StyledMenuLoader.qml b/framework/uicomponents/qml/Muse/UiComponents/StyledMenuLoader.qml index 1c0a3ceb7d..0ca30d3fba 100644 --- a/framework/uicomponents/qml/Muse/UiComponents/StyledMenuLoader.qml +++ b/framework/uicomponents/qml/Muse/UiComponents/StyledMenuLoader.qml @@ -146,10 +146,14 @@ Loader { if (x !== -1) { menu.x = x + } else { + menu.x = 0 } if (y !== -1) { menu.y = y + } else { + menu.y = Qt.binding(() => menu.parent?.height ?? 0) } } diff --git a/framework/uicomponents/qml/Muse/UiComponents/menuview.cpp b/framework/uicomponents/qml/Muse/UiComponents/menuview.cpp index 4251bb1425..0fe4ead2da 100644 --- a/framework/uicomponents/qml/Muse/UiComponents/menuview.cpp +++ b/framework/uicomponents/qml/Muse/UiComponents/menuview.cpp @@ -23,7 +23,6 @@ #include "menuview.h" #include "log.h" -#include "defer.h" using namespace muse::uicomponents; @@ -111,9 +110,6 @@ void MenuView::updateGeometry() return; } - setLocalX(0); - setLocalY(parent->height()); - const QPointF parentTopLeft = parent->mapToGlobal(QPoint(0, 0)); if (m_globalPos.isNull()) { @@ -317,7 +313,6 @@ void MenuView::setDesiredHeight(int desiredHeight) emit desiredHeightChanged(); QMetaObject::invokeMethod(this, [this] { - updateGeometry(); repositionWindowIfNeed(); }, Qt::QueuedConnection); } @@ -337,7 +332,6 @@ void MenuView::setDesiredWidth(int desiredWidth) emit desiredWidthChanged(); QMetaObject::invokeMethod(this, [this] { - updateGeometry(); repositionWindowIfNeed(); }, Qt::QueuedConnection); }