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. Loading busyindicator on android at startupp
Forum Update on Monday, May 27th 2025

Loading busyindicator on android at startupp

Scheduled Pinned Locked Moved Solved Mobile and Embedded
10 Posts 3 Posters 561 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.
  • T Offline
    T Offline
    track
    wrote on 29 Jun 2023, 10:35 last edited by
    #1

    My android app takes a long time (+/-10 minutes) when it loads on android device and would like to have a busy indicator running while it is still loading to device.
    I would appreciate if i could be assisted in getting the busyindicator running or having the app loading faster even if is diagnosing the problem of it loading slowly.

    J 1 Reply Last reply 29 Jun 2023, 11:17
    0
    • T Offline
      T Offline
      track
      wrote on 5 Mar 2025, 07:39 last edited by
      #10

      I finally got it to work by creating a qml file 'HeavyComponents.qml' "// HeavyComponents.qml (Main Entry Point)
      import QtQuick 2.15
      import QtQuick.Controls 2.15
      import QtQuick.Controls.Material 2.15

      ApplicationWindow {
      id: loadingWindow
      visible: true
      width: 200
      height: 460
      title: "Loading with Busy Indicator"
      color: "white"
      opacity: 1.0 // Initial opacity

      // Busy Indicator to show while loading
      BusyIndicator {
          id: busyIndicator
          anchors.centerIn: parent
          running: true
          visible: true
          width: 100
          height: 100
      }
      
      // Loader element to asynchronously load the heavy components
      Loader {
          id: loader
          source: "qrc:/main.qml"  // Load main.qml asynchronously
          asynchronous: true
          visible: false  // Initially hidden
      
          onLoaded: {
              busyIndicator.running = false;  // Hide the busy indicator
               console.log("Loading complete!");
              loader.visible = true;
      
               
              // Start the fade-out animation
              fadeOut.start();
          }
      }
      
      Component.onCompleted: {
          // Start loading the heavy components
          console.log("Starting to load heavy components...");
          loader.visible = true;
      }
      
      // NumberAnimation to fade out the loading window
      NumberAnimation {
          id: fadeOut
          target: loadingWindow
          property: "opacity"
          to: 0
          duration: 3000  // 3 seconds
          onStopped: {
                   loadingWindow.visible=false
      
          }
      }
      

      }
      " which is loaded in "main.cpp" and it uses a loader to load main.qml

      1 Reply Last reply
      1
      • T track
        29 Jun 2023, 10:35

        My android app takes a long time (+/-10 minutes) when it loads on android device and would like to have a busy indicator running while it is still loading to device.
        I would appreciate if i could be assisted in getting the busyindicator running or having the app loading faster even if is diagnosing the problem of it loading slowly.

        J Online
        J Online
        jsulm
        Lifetime Qt Champion
        wrote on 29 Jun 2023, 11:17 last edited by
        #2

        @track In QML (you did not say what you're using) there is https://doc.qt.io/qt-5/qml-qtquick-controls2-busyindicator.html

        https://forum.qt.io/topic/113070/qt-code-of-conduct

        P 1 Reply Last reply 29 Jun 2023, 11:21
        0
        • J jsulm
          29 Jun 2023, 11:17

          @track In QML (you did not say what you're using) there is https://doc.qt.io/qt-5/qml-qtquick-controls2-busyindicator.html

          P Offline
          P Offline
          piervalli
          wrote on 29 Jun 2023, 11:21 last edited by
          #3

          @jsulm
          Sorry, why do you need 10 minutes?
          It very long time, Are you sure the customer used it?

          J T 2 Replies Last reply 29 Jun 2023, 11:22
          0
          • P piervalli
            29 Jun 2023, 11:21

            @jsulm
            Sorry, why do you need 10 minutes?
            It very long time, Are you sure the customer used it?

            J Online
            J Online
            jsulm
            Lifetime Qt Champion
            wrote on 29 Jun 2023, 11:22 last edited by
            #4

            @piervalli You should reply to OP, not to me

            https://forum.qt.io/topic/113070/qt-code-of-conduct

            P 1 Reply Last reply 29 Jun 2023, 11:24
            0
            • J jsulm
              29 Jun 2023, 11:22

              @piervalli You should reply to OP, not to me

              P Offline
              P Offline
              piervalli
              wrote on 29 Jun 2023, 11:24 last edited by
              #5

              @jsulm sorry

              1 Reply Last reply
              0
              • P piervalli
                29 Jun 2023, 11:21

                @jsulm
                Sorry, why do you need 10 minutes?
                It very long time, Are you sure the customer used it?

                T Offline
                T Offline
                track
                wrote on 30 Jun 2023, 07:07 last edited by
                #6

                @piervalli I don't need 10 minutes, it takes a long time because I guess of multiple inline components, animations and JavaScript. I would like to have a busyindicator that shows that it is still loading, and the customer must not think it is faulty.

                1 Reply Last reply
                0
                • T Offline
                  T Offline
                  track
                  wrote on 8 Jul 2023, 10:25 last edited by
                  #7

                  Can I use qml profiler to check where the code is slow, if so, how?

                  1 Reply Last reply
                  0
                  • T Offline
                    T Offline
                    track
                    wrote on 8 Jul 2023, 10:54 last edited by
                    #8

                    Is is posible to place busyindictor in this main file where it is written 'qDebug() << " Starting QApplication " ;' .
                    If so please assist with code or tips.

                    `
                    #include <QQmlApplicationEngine>
                    #include <QApplication>
                    #include <QSslSocket>

                    //#include "services.h"
                    #include "ellipseitem.h"
                    #include <QtQuick>
                    #include <QtQml>

                    int main(int argc, char *argv[])
                    {
                    QCoreApplication::setAttribute(Qt::AA_EnableHighDpiScaling);
                    QApplication app(argc, argv);
                    qDebug() << " Starting QApplication " ;

                     qmlRegisterType<EllipseItem>("Shapes", 1, 0, "Ellipse");
                    
                     QQmlApplicationEngine engine;
                     engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
                    qDebug() << "Device supports OpenSSL: " << QSslSocket::supportsSsl();
                    qDebug() << "sslLibraryBuildVersionString "<< QSslSocket::sslLibraryBuildVersionString();
                    return app.exec();
                    

                    }

                    1 Reply Last reply
                    0
                    • T Offline
                      T Offline
                      track
                      wrote on 25 Jul 2023, 01:48 last edited by
                      #9

                      I tried to solve the problem by creating two Applicationwindow in main1.qml(contains busyindicator ) and main.qml like this

                      
                       #include <QQmlApplicationEngine>
                      #include <QApplication>
                      #include <QSslSocket>
                      
                       #include "ellipseitem.h"
                       #include <QtQuick>
                      #include <QtQml>
                      
                      int main(int argc, char *argv[])
                      {
                         
                          QApplication app(argc, argv);
                       
                           qmlRegisterType<EllipseItem>("Shapes", 1, 0, "Ellipse");
                            QQmlApplicationEngine engine;
                            engine.load(QUrl(QStringLiteral("qrc:/main1.qml")));
                            
                            engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
                      
                        
                      
                          return app.exec();
                      }
                      

                      The application loads after the exection of this line ' engine.load(QUrl(QStringLiteral("qrc:/main.qml")));
                      ' and I want to close main1.qml after the execution of this line so that busyindicator stops running.

                      How can i close main1.qml?

                      1 Reply Last reply
                      0
                      • T Offline
                        T Offline
                        track
                        wrote on 5 Mar 2025, 07:39 last edited by
                        #10

                        I finally got it to work by creating a qml file 'HeavyComponents.qml' "// HeavyComponents.qml (Main Entry Point)
                        import QtQuick 2.15
                        import QtQuick.Controls 2.15
                        import QtQuick.Controls.Material 2.15

                        ApplicationWindow {
                        id: loadingWindow
                        visible: true
                        width: 200
                        height: 460
                        title: "Loading with Busy Indicator"
                        color: "white"
                        opacity: 1.0 // Initial opacity

                        // Busy Indicator to show while loading
                        BusyIndicator {
                            id: busyIndicator
                            anchors.centerIn: parent
                            running: true
                            visible: true
                            width: 100
                            height: 100
                        }
                        
                        // Loader element to asynchronously load the heavy components
                        Loader {
                            id: loader
                            source: "qrc:/main.qml"  // Load main.qml asynchronously
                            asynchronous: true
                            visible: false  // Initially hidden
                        
                            onLoaded: {
                                busyIndicator.running = false;  // Hide the busy indicator
                                 console.log("Loading complete!");
                                loader.visible = true;
                        
                                 
                                // Start the fade-out animation
                                fadeOut.start();
                            }
                        }
                        
                        Component.onCompleted: {
                            // Start loading the heavy components
                            console.log("Starting to load heavy components...");
                            loader.visible = true;
                        }
                        
                        // NumberAnimation to fade out the loading window
                        NumberAnimation {
                            id: fadeOut
                            target: loadingWindow
                            property: "opacity"
                            to: 0
                            duration: 3000  // 3 seconds
                            onStopped: {
                                     loadingWindow.visible=false
                        
                            }
                        }
                        

                        }
                        " which is loaded in "main.cpp" and it uses a loader to load main.qml

                        1 Reply Last reply
                        1
                        • T track has marked this topic as solved on 5 Mar 2025, 08:10

                        • Login

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