How to get height of menuBar?
-
Hi,
I am just starting to use the Qt Quick Controls and now have a simple ApplicationWindow, its menuBar and a simple Layout in it.
I'd like to initially set the size of the ApplicationWindow to its content and set
@ property int margin: 11
width: mainLayout.implicitWidth + 2 * margin
height: mainLayout.implicitHeight + 2 * margin@However, I don't know how to get the height of the menuBar and the documentation says there are no properties like that for the menuBar.
Here is the full qml description:
@import QtQuick 2.1
import QtQuick.Controls 1.0
import QtQuick.Layouts 1.0ApplicationWindow {
title: "MyTest" id: mainWindow property int margin: 11 width: mainLayout.implicitWidth + 2 * margin height: mainLayout.implicitHeight + 2 * margin minimumWidth: mainLayout.Layout.minimumWidth + 2 * margin minimumHeight: mainLayout.Layout.minimumHeight + 2 * margin menuBar: MenuBar { Menu { title: "File" MenuItem { text: "Open..." } MenuItem { text: "Close" } } Menu { title: "Edit" MenuItem { text: "Cut" } MenuItem { text: "Copy" } MenuItem { text: "Paste" } } } ColumnLayout { id: mainLayout anchors.fill: parent anchors.margins: margin GroupBox { id: rowBox x: 122 y: 195 title: "Row layout" Layout.fillWidth: true RowLayout { id: rowLayout anchors.fill: parent TextField { placeholderText: "This wants to grow horizontally" Layout.fillWidth: true } Button { text: "Button" } } } }
}@
Can anyone help? ;)