Forums

OverviewFelgo 2 Support (Qt 5) › Multiple open Windows

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #22522

    Felgo User

    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

Viewing 1 post (of 1 total)

RSS feed for this thread

You must be logged in to reply to this topic.

Voted #1 for:

  • Easiest to learn
  • Most time saving
  • Best support

Develop Cross-Platform Apps and Games 50% Faster!

  • Voted the best supported, most time-saving and easiest to learn cross-platform development tool
  • Based on the Qt framework, with native performance and appearance on all platforms including iOS and Android
  • Offers a variety of plugins to monetize, analyze and engage users
FREE!
create apps
create games
cross platform
native performance
3rd party services
game network
multiplayer
level editor
easiest to learn
biggest time saving
best support