Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Mobile and Embedded
  4. Widget QSplashScreen still not working in Android
Forum Updated to NodeBB v4.3 + New Features

Widget QSplashScreen still not working in Android

Scheduled Pinned Locked Moved Solved Mobile and Embedded
7 Posts 3 Posters 657 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.
  • G Offline
    G Offline
    Gourmet
    wrote on last edited by
    #1
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        QPixmap splashpic("qrc:/splash.png");
        //QSplashScreen splash(splashpic.scaledToWidth(QApplication::desktop()->availableGeometry().width()));
        QSplashScreen splash(splashpic);
        splash.show();
        a.processEvents();
        QTextCodec* codec = QTextCodec::codecForName("UTF-8");
        QTextCodec::setCodecForLocale(codec);
        MainWindow w(Q_NULLPTR);
        w.show();
        splash.finish(&w);
        return a.exec();
    }
    

    White screen before main window appears. Qt 5.12, Android 7.1.

    J.HilkJ 1 Reply Last reply
    0
    • G Gourmet
      int main(int argc, char *argv[])
      {
          QApplication a(argc, argv);
          QPixmap splashpic("qrc:/splash.png");
          //QSplashScreen splash(splashpic.scaledToWidth(QApplication::desktop()->availableGeometry().width()));
          QSplashScreen splash(splashpic);
          splash.show();
          a.processEvents();
          QTextCodec* codec = QTextCodec::codecForName("UTF-8");
          QTextCodec::setCodecForLocale(codec);
          MainWindow w(Q_NULLPTR);
          w.show();
          splash.finish(&w);
          return a.exec();
      }
      

      White screen before main window appears. Qt 5.12, Android 7.1.

      J.HilkJ Offline
      J.HilkJ Offline
      J.Hilk
      Moderators
      wrote on last edited by
      #2

      @Gourmet QSplashscreen is not the class to go on android, it‘s made more for Desktop apps.

      You have to go native on this with a drawable

      see this link, it should help greatly

      https://medium.com/@benlaud/complete-guide-to-make-a-splash-screen-for-your-qml-android-application-567ca3bc70af#.8mu6d1eup


      Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


      Q: What's that?
      A: It's blue light.
      Q: What does it do?
      A: It turns blue.

      G 1 Reply Last reply
      2
      • J.HilkJ J.Hilk

        @Gourmet QSplashscreen is not the class to go on android, it‘s made more for Desktop apps.

        You have to go native on this with a drawable

        see this link, it should help greatly

        https://medium.com/@benlaud/complete-guide-to-make-a-splash-screen-for-your-qml-android-application-567ca3bc70af#.8mu6d1eup

        G Offline
        G Offline
        Gourmet
        wrote on last edited by
        #3

        @J-Hilk said in Widget QSplashScreen still not working in Android:

        QSplashscreen is not the class to go on android, it‘s made more for Desktop apps.

        Isn't Qt a multiplatform framework? What is the major difference between splash on desktop and mobile? Why QSplashScreen cannot work on mobile as other widgets work?

        J.HilkJ 1 Reply Last reply
        0
        • G Gourmet

          @J-Hilk said in Widget QSplashScreen still not working in Android:

          QSplashscreen is not the class to go on android, it‘s made more for Desktop apps.

          Isn't Qt a multiplatform framework? What is the major difference between splash on desktop and mobile? Why QSplashScreen cannot work on mobile as other widgets work?

          J.HilkJ Offline
          J.HilkJ Offline
          J.Hilk
          Moderators
          wrote on last edited by J.Hilk
          #4

          @Gourmet said in Widget QSplashScreen still not working in Android:

          Why QSplashScreen cannot work on mobile as other widgets work

          QSplashScreen works exactly as other widgets work. Thats the problem.

          The Splashscreen, the white one in your case, is provided by the OS (android in this case) during startup of your applications. Once Android handles the paint operation to your application you see your QSplashscreen


          Be aware of the Qt Code of Conduct, when posting : https://forum.qt.io/topic/113070/qt-code-of-conduct


          Q: What's that?
          A: It's blue light.
          Q: What does it do?
          A: It turns blue.

          G 1 Reply Last reply
          1
          • J.HilkJ J.Hilk

            @Gourmet said in Widget QSplashScreen still not working in Android:

            Why QSplashScreen cannot work on mobile as other widgets work

            QSplashScreen works exactly as other widgets work. Thats the problem.

            The Splashscreen, the white one in your case, is provided by the OS (android in this case) during startup of your applications. Once Android handles the paint operation to your application you see your QSplashscreen

            G Offline
            G Offline
            Gourmet
            wrote on last edited by Gourmet
            #5

            @J-Hilk I think this is a bug. Strange but I did not find any report about this. Therefore I created new one. It is already marked as P2 Important... https://bugreports.qt.io/browse/QTBUG-85253

            1 Reply Last reply
            0
            • G Offline
              G Offline
              Gourmet
              wrote on last edited by
              #6

              I temporary solved this with simple actions:

              1. Created 3 static splash screen pictures in resolutions 800x480, 1280x800, 1920x1150 with same name splash.png and placed them to folders android/res/drawable-ldpi, android/res/drawable-mdpi, android/res/drawable-hdpi respectively.
              2. Uncommeted in AndroidManifest.xml line:
                          <meta-data android:name="android.app.splash_screen_drawable" android:resource="@drawable/splash"/>
              

              Then built the application. First white screen with app name appears for short time about 1 second. Then my image appears for all other time needed for application initialization. This is not best solution cause it does not allow show init process dynamically in splash. But it is much better than just white screen.

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                If you want something more fancy, there are links provided in the bug reports to help you do that.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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