Using QQmlApplicationEngine.load and QGuiApplication.exec to load a new screen
Unsolved
Mobile and Embedded
-
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.