Important: Please read the Qt Code of Conduct -

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

    Expected Result:

    1. open both apps
    2. double click "clicking" app
    3. menu from "menu" app opens
    4. click outside menu
    5. menu closes

    Actual Result:

    1-4 same as above

    1. menu doesn't close, unless I click in "menu" app's window or press the Esc key

    question on stackoverflow

  • 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.

    1. build and run testqmenudbus2
    2. open qdbusviewer
    3. find the service org.TestQMenu
    4. find the method showMenu in TestQMenu.local.MainWindow
    5. double click method

  • Solved it by adding


    to the dbus method before showing the menu.

Log in to reply