Important: Please read the Qt Code of Conduct -

Menu items get stuck in debug

  • When I'm debugging an application with Qml menus I can't click anywhere else once I click on a Menu. As an example I was testing with this code in ApplicationWindow
    @ menuBar: MenuBar {
    Menu {
    title: qsTr("File")
    MenuItem {
    text: qsTr("Exit")
    onTriggered: Qt.quit();

        Menu {
            title: "Test 1"
            MenuItem { text: "1" }
            MenuItem { text: "2" }
            MenuItem { text: "3" }

    If I'm running in debug and I click File, then the menu stays open until I click something within that menu. I.e. I can't click in the window, I can't mouse over to Test 1, and I can't close via windows decorations. I can move the window which ends up leaving the menu behind. This works perfectly fine if I'm not running debug.

    I've also discovered the same thing happening with qmlscene. If I run the gallery example with qmlscene it works fine, but if I run qmlscene under gdb the menus don't work (become sticky).

    My gdb version: GNU gdb (GDB)

  • This was a hint
    @Qt: gdb: -nograb added to command-line options.
    Use the -dograb option to enforce grabbing.
    I passed -dograb to run in gdb and this solved the issue.

Log in to reply