MenuBarStyle, setting the font
Unsolved
QML and Qt Quick
-
Need to change the font of a Menubar. However, this code doen`t seem to work
menuBar: MenuBar { style: MenuBarStyle { background: Rectangle { color: "#FFFFFF" } font: "Microsoft JhengHei UI" } Menu { title: "&File" MenuItem { text: "Quit"; onTriggered: Qt.quit() } } Menu { title: "&Help" MenuItem { text: "About..." ; onTriggered: aboutBox.open() } } }
The error is:
qrc:/MainWindow.qml:51 Invalid property assignment: unsupported type "QFont"What am I missing?
-
Hi! The correct way to do it is either like this:
style: MenuBarStyle { background: Rectangle { color: "#FFFFFF" } font { family: "Comic Sans MS"; pixelSize: 20; capitalization: Font.AllUppercase } // no ":" }
or like that:
menuBar: MenuBar { style: MenuBarStyle { background: Rectangle { color: "#FFFFFF" } font.family: "Comic Sans MS" font.pixelSize: 20 font.capitalization: Font.AllUppercase }