Solved Can't close a QMenu opened through dbus by double clicking in another app
-
I have 2 applications, 1 has a QMenu that can be opened through DBus ("menu" app) and the other can open that menu by double clicking ("clicking" app).
When I open the menu by double clicking in the "clicking" app the menu doesn't close when I click outside of the menu.
The menu closes when:
- opened through qdbus in the terminal
- opened through single click in "clicking" app
- pressing Esc key
If the menu belongs to the same app then it closes.
Here are the 2 applications
https://gitlab.com/fbg/qmenu-dbus-test
Expected Result:
- open both apps
- double click "clicking" app
- menu from "menu" app opens
- click outside menu
- menu closes
Actual Result:
1-4 same as above
- menu doesn't close, unless I click in "menu" app's window or press the Esc key
-
This happens in Solus 4.0 Plasma
- KDE Plasma Version: 5.15.3
- KDE Frameworks Version: 5.56.0
- Qt Version: 5.12.2
In lubuntu (lxqt) the menu shows for a split second and then closes.
A simpler way to test this is to use qdbusviewer.
- build and run testqmenudbus2
- open qdbusviewer
- find the service org.TestQMenu
- find the method showMenu in TestQMenu.local.MainWindow
- double click method
-
Solved it by adding
QThread::msleep(150);
to the dbus method before showing the menu.