Reputation: 1108
I'm quite new to Qt and i'm having a problem with a Menubar. I just copied the example code from here and added a surrounding MenuBar-Tag
MenuBar{
Menu {
title: "Edit"
MenuItem {
text: "Cut"
shortcut: "Ctrl+X"
onTriggered: console.log("test")
}
MenuItem {
text: "Copy"
shortcut: "Ctrl+C"
onTriggered: console.log("test")
}
MenuItem {
text: "Paste"
shortcut: "Ctrl+V"
onTriggered: console.log("test")
}
MenuSeparator { }
Menu {
title: "More Stuff"
MenuItem {
text: "Do Nothing"
}
}
}
}
On Mac does it work properly but on Windows I can't see any menu. Does anyone have any ideas?
Thanks in advance!
Upvotes: 1
Views: 424
Reputation: 40512
If you want to add menu bar to a window, you need to set menuBar
property value. See this page:
ApplicationWindow {
id: window
menuBar: MenuBar {
Menu { MenuItem {...} }
Menu { MenuItem {...} }
}
}
May be it doesn't matter on Mac because QMenuBar
works differently on Mac and is automatically attached to windows.
Upvotes: 1