Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. SplashScreen implementation question
Qt 6.11 is out! See what's new in the release blog

SplashScreen implementation question

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 470 Views 1 Watching
  • 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.
  • M Offline
    M Offline
    ml16685
    wrote on last edited by ml16685
    #1

    Hello,

    I have an embedded Qt application for Linux which has the following startup code:

    int main(int argc, char *argv[])
    {

       QApplication app(argc, argv);
    // Startup actions neeeded to display AppView correctly
    // Black screen is shown for several seconds
    // ...
    
    QQuickView AppView;
    AppView.setSource(QUrl(QStringLiteral("main.qml")));
    AppView.resize(480, 800);
    AppView.show();
    return app.exec();
    

    }

    I'd like to remove the black screen shown before AppView and to display QML animation
    instead of it.

    I see two possible options here but non of them is clear. Could you please advice
    which one of them is more correct and also comment/answer the questions in each.

    1. To display QSplashScreen at the beginnning of main().

    int main(int argc, char *argv[])
    {

    QApplication app(argc, argv);
    QSplashScreen *splash = new QSplashScreen();
    splash->show();
    
    // Startup actions neeeded to display AppView correctly
    // Black screen is shown for several seconds
    // ...  
    

    }

    The question here is what API to use to attach QML animation to QSplashScreen?
    QSplashScreen inherits from QWidget, and so as I understand, no API like QQuickWidget::setSource() can be used.

    1. To display another QQuickView at the beginnning of main() with attached QML animation.

    int main(int argc, char *argv[])
    {

    QApplication app(argc, argv);
    QQuickView SplashView;
    SplashView.setSource(QUrl(QStringLiteral("SplashScreen.qml")));
    SplashView.resize(480, 800);
    SplashView.show();
    app.exec();
    
    // Startup actions neeeded to display AppView correctly
    // Black screen is shown for several seconds
    // ...
    
    QQuickView AppView;
    AppView.setSource(QUrl(QStringLiteral("main.qml")));
    AppView.resize(480, 800);
    AppView.show();
    

    }

    The question here is how to to close the SplashView and to display AppView on top of it?

    Thanks

    raven-worxR 1 Reply Last reply
    0
    • M ml16685

      Hello,

      I have an embedded Qt application for Linux which has the following startup code:

      int main(int argc, char *argv[])
      {

         QApplication app(argc, argv);
      // Startup actions neeeded to display AppView correctly
      // Black screen is shown for several seconds
      // ...
      
      QQuickView AppView;
      AppView.setSource(QUrl(QStringLiteral("main.qml")));
      AppView.resize(480, 800);
      AppView.show();
      return app.exec();
      

      }

      I'd like to remove the black screen shown before AppView and to display QML animation
      instead of it.

      I see two possible options here but non of them is clear. Could you please advice
      which one of them is more correct and also comment/answer the questions in each.

      1. To display QSplashScreen at the beginnning of main().

      int main(int argc, char *argv[])
      {

      QApplication app(argc, argv);
      QSplashScreen *splash = new QSplashScreen();
      splash->show();
      
      // Startup actions neeeded to display AppView correctly
      // Black screen is shown for several seconds
      // ...  
      

      }

      The question here is what API to use to attach QML animation to QSplashScreen?
      QSplashScreen inherits from QWidget, and so as I understand, no API like QQuickWidget::setSource() can be used.

      1. To display another QQuickView at the beginnning of main() with attached QML animation.

      int main(int argc, char *argv[])
      {

      QApplication app(argc, argv);
      QQuickView SplashView;
      SplashView.setSource(QUrl(QStringLiteral("SplashScreen.qml")));
      SplashView.resize(480, 800);
      SplashView.show();
      app.exec();
      
      // Startup actions neeeded to display AppView correctly
      // Black screen is shown for several seconds
      // ...
      
      QQuickView AppView;
      AppView.setSource(QUrl(QStringLiteral("main.qml")));
      AppView.resize(480, 800);
      AppView.show();
      

      }

      The question here is how to to close the SplashView and to display AppView on top of it?

      Thanks

      raven-worxR Offline
      raven-worxR Offline
      raven-worx
      Moderators
      wrote on last edited by raven-worx
      #2

      @ml16685
      IMO save yourself some struggle and simply use a Loader QML element as your root item in the window.
      Do not spawn multiple event loops, QML engines, etc.

      --- SUPPORT REQUESTS VIA CHAT WILL BE IGNORED ---
      If you have a question please use the forum so others can benefit from the solution in the future

      M 1 Reply Last reply
      4
      • raven-worxR raven-worx

        @ml16685
        IMO save yourself some struggle and simply use a Loader QML element as your root item in the window.
        Do not spawn multiple event loops, QML engines, etc.

        M Offline
        M Offline
        ml16685
        wrote on last edited by
        #3

        @raven-worx Thank you, will try this approach.

        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 Extensions
        • Unsolved