SUMMARY QQuickMenu::popup(QQuickItem *menuItem) opens the menu based on the size of its parent and its size, and when all menu items are invisible, ListView calculates its contentHeight based on an assumed average size (100), so the menu doesn't open at the right position for the first time. STEPS TO REPRODUCE 1. Right click on any selectable label which only has one line 2. 3. OBSERVED RESULT EXPECTED RESULT SOFTWARE/OS VERSIONS Windows: macOS: Linux/KDE Plasma: (available in About System) KDE Plasma Version: 6. KDE Frameworks Version: Qt Version: 6.6.1 ADDITIONAL INFORMATION
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/370
Git commit 3c64f731aa115372964fff2756d3d874953526ae by Fushan Wen. Committed on 16/02/2024 at 22:56. Pushed by fusionfuture into branch 'master'. Menu: fix TextFieldContextMenu opening at wrong position QQuickMenu places the menu based on the size of its parent and its size, but when all menu items are invisible, the ListView in Menu.qml calculates its contentHeight based on an assumed average size (100), which causes the menu height to become excessively huge when there are many invisible menu items, so when repositioning the menu will be placed at a wrong position. This uses childrenRect.height to only include visible items. FIXED-IN: 6.0 M +5 -3 org.kde.desktop/Menu.qml https://invent.kde.org/frameworks/qqc2-desktop-style/-/commit/3c64f731aa115372964fff2756d3d874953526ae
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/qqc2-desktop-style/-/merge_requests/374
Git commit 7b0d7e49b4a52166549f7a36687f91d4417f77f2 by Fushan Wen. Committed on 23/02/2024 at 13:53. Pushed by fusionfuture into branch 'master'. autotests: test TextFieldContextMenu Setting TapHandler's longPressThreshold to 0 will disable the longPressed signal since Qt 6.6.2, which breaks the text context menu again. This adds a test to make sure the menu can be opened, and catch potential regressions caused by upstream changes in the future. CCQTBUG: https://bugreports.qt.io/browse/QTBUG-119132 M +10 -0 kirigami-plasmadesktop-integration/autotests/CMakeLists.txt A +82 -0 kirigami-plasmadesktop-integration/autotests/TextFieldContextMenuTest.cpp [License: LGPL(v2.1+)] A +19 -0 kirigami-plasmadesktop-integration/autotests/TextFieldContextMenuTest.qml [License: MIT] M +3 -16 kirigami-plasmadesktop-integration/autotests/animationspeedmodifiertest.cpp A +37 -0 kirigami-plasmadesktop-integration/autotests/common.h [License: LGPL(v2.1+)] https://invent.kde.org/frameworks/qqc2-desktop-style/-/commit/7b0d7e49b4a52166549f7a36687f91d4417f77f2
A possibly relevant merge request was started @ https://invent.kde.org/frameworks/kirigami/-/merge_requests/1652
Git commit 94b0513ec9ebb32c0df6edbef53b19c8ef11064f by Akseli Lahtinen. Committed on 28/10/2024 at 09:24. Pushed by akselmo into branch 'master'. SelectableLabel: Use onPressedChanged OnTapped does not immediately show the context menu when label is rightclicked, breaking QQC2 CI in the process. OnTapped shows the context menu *after* right click is released. This changes it to be similar to other elements we have like TextField where right click brings the context menu immediately, instead of on right click button release. We utilize onPressedChanged, then check if pressed is true, to pop up the context menu immediately. M +1 -1 src/controls/SelectableLabel.qml https://invent.kde.org/frameworks/kirigami/-/commit/94b0513ec9ebb32c0df6edbef53b19c8ef11064f