Loading busyindicator on android at startupp
-
wrote on 29 Jun 2023, 10:35 last edited by
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. -
wrote on 5 Mar 2025, 07:39 last edited by
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.15ApplicationWindow {
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 -
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.@track In QML (you did not say what you're using) there is https://doc.qt.io/qt-5/qml-qtquick-controls2-busyindicator.html
-
@track In QML (you did not say what you're using) there is https://doc.qt.io/qt-5/qml-qtquick-controls2-busyindicator.html
-
@jsulm
Sorry, why do you need 10 minutes?
It very long time, Are you sure the customer used it?@piervalli You should reply to OP, not to me
-
@piervalli You should reply to OP, not to me
-
@jsulm
Sorry, why do you need 10 minutes?
It very long time, Are you sure the customer used it?wrote on 30 Jun 2023, 07:07 last edited by@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.
-
wrote on 8 Jul 2023, 10:25 last edited by
Can I use qml profiler to check where the code is slow, if so, how?
-
wrote on 8 Jul 2023, 10:54 last edited by
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();
}
-
wrote on 25 Jul 2023, 01:48 last edited by
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?
-
wrote on 5 Mar 2025, 07:39 last edited by
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.15ApplicationWindow {
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 -