Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt
  • Unsolved
Collapse
qtws26_logo

The Qt Event of the Year: Qt World Summit 2026

Save Your Spot >
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Using QQmlApplicationEngine.load and QGuiApplication.exec to load a new screen
Qt 6.12 LTS is out! See what's new in the release blog

Using QQmlApplicationEngine.load and QGuiApplication.exec to load a new screen

Scheduled Pinned Locked Moved Unsolved Mobile and Embedded
1 Posts 1 Posters 295 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rlush
    wrote on last edited by
    #1

    I have inherited some code that requires a reboot to load a new screen. When the device goes into a firmware upgrade mode they shut the whole system down, reboot the processor and start the application with a new command line switch. In an effort to speed things up without changing too much I want to call

    qApp->exit( EXIT_CODE_FIRMWARE_UPGRADE_STATUS)
    

    and then from main do something like this

        int iReturn = 0;
    
        do
        {
            if(iReturn == EXIT_CODE_FIRMWARE_UPGRADE_STATUS)
            {
                // Firmware Upgrade Mode
                engine.load ( QUrl ( QStringLiteral ( "qrc:/qml/FirmwareUpgradeStatus.qml" ) ) );
                qDebug ( ) << "Show firmware upgrade status from main";
            }
            else if(argv[1] == 0)
            {
                nvmFileHandler.removeUpgradedFirmwareVersion ( );
                engine.load ( QUrl ( QStringLiteral ( "qrc:/qml/main.qml" ) ) );
            }
            else if ( engine.rootObjects().isEmpty() )
            {
                qDebug ( ) << "Nothing was loaded into the engine, so exit";
                // Return something meaningful so we don't get stuck in a boot loop
                return -1;
            }
    
            // Start the Qt application based on what is loaded in the engine
            iReturn = app.exec( );
    
            // Unload whats there so we can load something new if needed
            engine.rootObjects().clear();
    
        }while(iReturn);
    

    However, its telling me

    EGLFS: OpenGL windows cannot be mixed with others.

    Am I close to something useful or have I gone in the wrong direction? I don't want to have to rip all the old code up to do things the "right" way, I just need something better than reloading the entire program.

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt
    • Unsolved