I am building a desktop application using QML and QtQuick.Components. I want to place on the toolbar buttons, as in the standard MacOS settings dialog boxes:
I use ToolBar and ToolButton , but I cannot find a way to do this. For example, with the following code, it shows only icons:
ApplicationWindow {
// ...
toolBar: ToolBar {
RowLayout {
ToolButton {
text: qsTr("Main")
iconSource: "main.png"
}
ToolButton {
text: qsTr("System")
iconSource: "system.png"
}
ToolButton {
text: qsTr("Items Book")
iconSource: "itemsbook.png"
}
}
}
}
And it looks like ToolButton can display either text or an icon:
Text {
id: textitem
text: button.text
anchors.centerIn: parent
visible: button.iconSource == "" // <=========
}
source
share