From 02949a9e51b5f9607ea71e3b9ca6d9b8c592fb8f 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 32154feedf..560fc04df1 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 75ddd21999..2d6252b2a6 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()) { @@ -318,7 +314,6 @@ void MenuView::setDesiredHeight(int desiredHeight) emit desiredHeightChanged(); QMetaObject::invokeMethod(this, [this] { - updateGeometry(); repositionWindowIfNeed(); }, Qt::QueuedConnection); } @@ -338,7 +333,6 @@ void MenuView::setDesiredWidth(int desiredWidth) emit desiredWidthChanged(); QMetaObject::invokeMethod(this, [this] { - updateGeometry(); repositionWindowIfNeed(); }, Qt::QueuedConnection); }