QApplication object construction time is too long
-
I want to use the
QSplashScreen. But i findQApplication a(argc,argv)orQtSingleApplication a(argc,argv)command take up too much time.First: I create new Qt Gui application to test the time. It was very good. just spend 1s;
#include "mainwindow.h" #include <QApplication> #include <QSplashScreen> #include <QThread> #include <QTime> #include <QDebug> int main(int argc, char *argv[]) { qDebug() << "0--" << QTime::currentTime();///< 0-- QTime("18:11:00.998") QApplication a(argc, argv); qDebug() << "1--" << QTime::currentTime();///< 1-- QTime("18:11:01.192") QPixmap pixmap(":/png/time.jpg"); QSplashScreen splash(pixmap); splash.show(); a.processEvents(); MainWindow w; QThread::sleep(5); w.show(); splash.finish(&w); return a.exec(); }Second: I test the time in my qt project now. using the
QApplicationit was spent 12s;#include "mainwindow.h" #include <QApplication> #include <QTime> #include <QDebug> int main(int argc, char *argv[]) { qDebug() << "0--" << QTime::currentTime(); ///< 0-- QTime("18:20:28.031") QApplication a(argc,argv); qDebug() << "1--" << QTime::currentTime(); ///< 1-- QTime("18:20:40.122") MainWindow w; w.show(); return a.exec(); }Last: Because i used the
QtSingleApplication. I doubt it. But, using the time is same withQApplicationboth about 12s.#include "module_singleApp/qtsingleapplication.h" #include "mainwindow.h" #include <QTime> #include <QDebug> #ifndef JOE int main(int argc, char *argv[]) { qDebug() << "0--" << QTime::currentTime(); ///< 0-- QTime("18:24:19.141") QtSingleApplication a(argc, argv); qDebug() << "1--" << QTime::currentTime(); ///< 1-- QTime("18:24:31.316") if(a.sendMessage("Wake up!")){ return 0; ///<Not allow to use the goto } MainWindow w; a.setActivationWindow(&w); w.show(); return a.exec(); }I guest the reason maybe is the load some dll and lib files in my pro file.
I just want to use the
QSplashScreenin my main.cpp file. But,QApplicationconstruct takes up too much time.I also test with release. also takes up too much time.
-_-!...
-
Both QGuiAppliaction and QApplication example are using a QApplication. Are you sure about those example ?
QSingleApplication doesn't seem to be part of the official Qt distribution. It might use deprecated functions. In my opinion, do not use it.
Do you pass any argument to your program ?
What is your system context ?
-
Both QGuiAppliaction and QApplication example are using a QApplication. Are you sure about those example ?
QSingleApplication doesn't seem to be part of the official Qt distribution. It might use deprecated functions. In my opinion, do not use it.
Do you pass any argument to your program ?
What is your system context ?
-
-
I want to use the
QSplashScreenprovides a splash screen that can be shown during application startup. but, i foundQtSingleApplication a(argc,argv)command takes up too much time.If i use
QSplashScreen, must be afterQtSingleApplication.How to save it?
-
Window is a bit vague, it can range from XP to 10.
What dependencies do you have ?