Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to perform tasks sequentially? [SOLVED]
Forum Updated to NodeBB v4.3 + New Features

How to perform tasks sequentially? [SOLVED]

Scheduled Pinned Locked Moved QML and Qt Quick
11 Posts 2 Posters 3.1k 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.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi,

    What do you mean by stuck ?

    Also, did you notice that you hide your QDeclarativeView ?

    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
    • G Offline
      G Offline
      godbod
      wrote on last edited by
      #3

      yes, I am sorry. But I still have the problem.
      To be clear, I need to :
      first : download a file,
      second : start the User Interface (only if I received the file)

      But it seems that the main.cpp doesn't wait for the downloaded file to be done by the NetworkModule

      L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

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

        You don't show anything in your code that suggest a download is in progress anywhere.

        You construct your NetworkModule and then check some state. Does anything happen in between ?

        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
        • G Offline
          G Offline
          godbod
          wrote on last edited by
          #5

          When I create the NetworkModule object, it calls the constructor that registers the SIGNALS connected and disconnected.
          Once we're connected, I add a readyread SIGNAL that allows me to receive the file.
          In the main code I gave, if I comment all the lines but the NetworkModule then I have my file downloaded.
          But if I add the other lines, I can't show information contained in the file because the UI lines overlap the NetworkModule that didn't end dowanloading...
          I need something like a semaphore...

          L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

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

            What do you use to download the database ?

            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
            • G Offline
              G Offline
              godbod
              wrote on last edited by
              #7

              I am using sockets

              L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

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

                Without any code, it's getting difficult to help you make a proper "wait until finished" download functionality

                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
                • G Offline
                  G Offline
                  godbod
                  wrote on last edited by
                  #9

                  thanks.

                  L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

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

                    You're download code won't work as your expect it to do (I don't know the size of your database but you'd be lucky if you get it all in one call) There have been several thread's on the subject these last days/weeks, search the forum for them. You should have a look at the Fortune Client/Server examples.

                    Also, connect the socket first and then initiate the connection (again I encourage you to read the examples).

                    Since you are using signals and slots, you'll need an event loop so either app.exec() or a QEventLoop. Thus you won't be able to achieve what you want to do the way you do it right now.

                    I would suggest to make a "manager" object that will start the download and once it's done, create the interface. The "done" being notified by a signal (both success and failure must be handled) once all data have been received. If the download takes time, you could use a progress dialog or a splash screen to let your user know that something is on the way.

                    Hope it helps

                    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
                    • G Offline
                      G Offline
                      godbod
                      wrote on last edited by
                      #11

                      Yeah, I managed to make a draft of a the manager. Now my application is waiting for the database before creating the interface.
                      Like you said, I'll need to have a splashcreen to display the downloading of the database as it may take some time...
                      thanks a lot.

                      L'imagination est tout, c'est l’aperçu des futures attractions de la vie.

                      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