Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to open a window before running app.exec() ?
Forum Updated to NodeBB v4.3 + New Features

How to open a window before running app.exec() ?

Scheduled Pinned Locked Moved Solved General and Desktop
3 Posts 2 Posters 331 Views 2 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.
  • T Offline
    T Offline
    tubbadu
    wrote on last edited by
    #1

    Hello there! Total noob here in c++ programming with Qt

    I have an application that before starting needs to unzip a file (using QProcess), and the operation may need some time, and then it should open a QML file that uses the unzipped files.

    I'd like to show a message, a loading indicator, something like this, until the unzipping process is ended. I tried something like this:

    QPushButton button("loading, please wait");
    button.show():
    
    unzip();
    
    butt.hide()
    
    const QUrl url(QStringLiteral("qrc:/main.qml"));
        QObject::connect(&engine, &QQmlApplicationEngine::objectCreated,
                         &app, [url](QObject *obj, const QUrl &objUrl) {
            if (!obj && url == objUrl)
                QCoreApplication::exit(-1);
        }, Qt::QueuedConnection);
        engine.load(url);
    
     return app.exec();
    
    

    but the button showing is completely blank, and loads its text only after app.exec() is executed, so after the unzip has ended
    what can I do to make it show before the unzip process has ended?

    thank you in advance!

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

      Hi,

      You are looking for either QProgressDialog or QSplashScreen.

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

      T 1 Reply Last reply
      3
      • SGaistS SGaist

        Hi,

        You are looking for either QProgressDialog or QSplashScreen.

        T Offline
        T Offline
        tubbadu
        wrote on last edited by
        #3

        @SGaist QSplashScreen is perfect!

        with app.processEvents(); I can show the splashscreen before running the main loop with app.exec()

        thank you very much!

        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