Unsolved Qt.labs MenuBar in QtQuick.Controls 2 Application Window
-
I'd like to attach a platform native MenuBar from Qt.labs as a QtQuick.Controls 2.1 ApplicationWindow header. However as MenuBar is an Object, not Item, that fails, and I can't find an example in the documentation.
What is the right way to use a Qt.labs.platform.MenuBar in an ApplicationWindow ?
-
A native Qt Labs MenuBar is currently available on the following platforms:
- macOS
- Android
- Linux (only available on desktop environments that provide a global D-Bus menu bar)
Unfortunately, you can't take a native menu bar and use it as a visual Qt Quick Item in
ApplicationWindow::header
or elsewhere. -
@jpnurmi Thanks the answer. How are you supposed to use the Qt Labs' menu bar, then ? Is there an example documented somewhere ? Thanks !
-
@charlesfleche Qt.labs has experimental things which are often less well documented than final supported things.
In my opinion Controls 2 UI doesn't mix well with platform native elements. It's meant to be completely cross-platform, looking and behaving the same on all platforms, unlike this MenuBar.
-
@Eeli-K Do you think I should not use QML then, and go back to QtWidgets for desktop apps ? I though that QML was the future for all sort of apps, not just mobile.
-
@charlesfleche That's something you have to decide yourself. Mixing Control1, Control2 and native elements may work well for you. Controls2 is the best for crossplatform mobile applications with non-native look&feel, C++ widgets for traditional desktop applications and Controls1 for crossplatform native experience with some tradeoffs. But's that's only my personal rough estimate based on imperfect experience and knowledge. It really depends on specific needs.