Hello,
Is there a good way to have multiple open windows in an app. Each window should be able to be interacted with independently. I found a possible solution on SO where I add the following:
main.cpp
QQuickWindow *p1 = engine.rootObjects()[0]->findChild<QQuickWindow *>("p1");
if(p1) {
p1->setTitle("P1");
}
QQuickWindow *p2 = engine.rootObjects()[0]->findChild<QQuickWindow *>("p2");
if(p2)
p2->setTitle("P2");
Main.qml
import Felgo 3.0
import QtQuick 2.12
import QtQuick.Window 2.12
App {
id: app
Window {
objectName: "p1"
visible: true
title: "P1"
width: 800
height: 600
}
Window {
id: wP2
objectName: "p2"
visible: true
title: "P2"
width: 800
height: 600
}
}
This method so far seems to work. When I run the app I get two Windows open as I want. However, is this method “good”? Is there a better way to do this? The only drawback I’ve found so far is that I have to rebuild the project every time I want to see any changes I make (any way to avoid this?).
Thank you,
Eric