Menubars in QtQuick Controls 2
MenuBar
is now available, and was added in Qt 5.10. Use QtQuick.Controls version 2.3 or later:
import QtQuick.Controls 2.3
Old answer:
As GrecKo said, desktop is not the focus of the module, and as such, you won't find a MenuBar
control as part of the main import. Up until recently, I've been using a RowLayout
that contains a bunch of ToolButton
controls, each of which opens a Menu
, in order to emulate a menu bar for a desktop application.
However, the Qt.labs.platform
module was recently added, which adds support for native controls like MenuBar
. The types in this module are fully native, at the expense of less customisability. You can already start using these if you clone the dev branch of qtquickcontrols2.git
.
By the way, if you're ever unsure what the equivalent type in Qt Quick Controls 2 is, there's a "Type Comparison Table" here (although it's unfortunately currently missing MenuBar
).
I asked the same question on Qt blog announcing release of Qt 5.7 and this is their answer: http://blog.qt.io/blog/2016/06/16/qt-5-7-released/#comment-1197915
So seems that we should either wait for Qt 5.8 or clone the repo as Mitch suggested in his answer.
Update
This is now implemented in Qt Quick Controls 2: https://doc.qt.io/qt-5.10/qml-qtquick-controls2-menubar.html