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!
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.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.