Advise on multiple top level QQuickView's
-
Hi,
I have an upcoming project that I would like Qt Quick 2 for, this particular project requires two top level scenes, full screen, on 2 separate monitors but they do have a requirement to share qml items. What is the best way to achieve this? Would multiple QQuickView's work sharing the same QQmlEngine or is there a better approach?
Thanks
-
Qt Quick 2 has built-in support for this. If you write the entire UI in Qt Quick, you can instead declare multiple instances of Window or ApplicationWindow in QML itself and use the non visual QQmlApplicationEngine to launch your app and implicitly create those windows using the same engine.
-
Yes. If you check the Window api here:
http://doc-snapshot.qt-project.org/qt5-stable/qtquick/qml-qtquick-window2-window.html -
Unlike QQuickView, your root node can be a simple QtObject if you are using QmlApplicationEngine. So in effect there is no such constraint.
@
QtObject {
property var test: Window {
width: 100
height: 100
visible: true
}
property var test2: Window {
width: 100
height: 100
visible: true
}
}
@Note that windows are not visible by default so you have to explicitly make them visible when doing this. (Root windows are implicitly set visible otherwise)