[Interest] Qt Quick MenuBar in subsections of a window

Damian Ivanov damianatorrpm at gmail.com
Wed Feb 26 09:23:39 CET 2014


the shortcuts are not a problem you get the menu, each button will
call the menu as if it was a "ContextMenu"
Row {
Menu{id:1 ....................
MenuItem {text: " TEST" ; shortcut: "Ctrl + C";ontriggered: "mystuff"}
Menu{id:2  ....................}
Menu{id:3 ....................}
Button {id:1 onClicked: menu1.popup()}
Button {id:2 onClicked: menu2.popup()}
Button {id:3 onClicked: menu3.popup()}
}

so you actually this approach is almost as complete as the menuBar,
here something I do for a custom menubar  including File, Edit or so +
a button in the menuBar
    Menu{id:menu;title:"File";
        Menu{title:"Open File";
            MenuItem{text:"XML config file";onTriggered:fileDialog.open();}
            MenuItem{text:"Storage System Support
Bundle";onTriggered:{storeBundleDialog.open();}}
            MenuItem{text:"Management Group Support
Bundle";onTriggered:mgBundleDialog.open();}}}
    Text{text:"File";MouseArea{anchors.fill:parent;onClicked:menu.popup();}}
    Button{id:button;text:"Check for
Notifications";onClicked:notificationsWindow.show()}
    Button{id:button2;text:"Upgrades";onClicked:console.log(myFile.lines())}}

2014-02-25 19:25 GMT+01:00 Alex Montgomery <apmontgomery at gmail.com>:
>
>
>
> On Tue, Feb 25, 2014 at 1:39 AM, Damian Ivanov <damianatorrpm at gmail.com>
> wrote:
>>
>> Hi Alex,
>>
>> depends on how you define menubar..
>> You can make a few buttons next to each other and every button
>> triggers it's own menu
>
>
> <snip>
>
> That's a good suggestion, but there are a lot of nice features that the Qt
> Quick MenuBar has (keyboard shortcuts, roll-over to adjacent menus when
> moving the mouse, etc) that I would rather not re-invent. I checked the
> source code on the MenuBar class and it seems to fall back to a nicely
> designed QML class when it can't find a native window. It would be great if
> that were exposed to us and we could embed that into other QML items, or at
> least use it with a window-type other than ApplicationWindow. Currently you
> cannot even use MenuBar with QQuickWindow:
> https://bugreports.qt-project.org/browse/QTBUG-31279
>
> Anyway, thanks for the response, but unless I'm mistaken, there's currently
> no way to use the MenuBar class as a sub-item in QML.
>
> Regards,
> Alex
>



More information about the Interest mailing list