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. Signal that a component is completed AND visible?
Forum Updated to NodeBB v4.3 + New Features

Signal that a component is completed AND visible?

Scheduled Pinned Locked Moved QML and Qt Quick
5 Posts 2 Posters 3.8k 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.
  • M Offline
    M Offline
    micha-
    wrote on last edited by
    #1

    Hello,

    is there a way to figure out that a qml component is loaded and visible? Component.onCompleted() seems to be signaled before the component is visible on the screen.

    Thanks!

    1 Reply Last reply
    0
    • G Offline
      G Offline
      Gennon
      wrote on last edited by
      #2

      Hi,

      I usually do not need another signal than Component.onCompleted(), so what is your scenario? Why do you need to know if it is visible as well?

      /Gen

      1 Reply Last reply
      0
      • M Offline
        M Offline
        micha-
        wrote on last edited by
        #3

        Hi,

        thanks for the reply. Starting from the main page, if a user presses a certain Button, I'm loading a totally new screen using the Loader component. For this particular screen I need to initialize and read in some data from external hardware, which might take a few seconds. I thought of starting this process upon Component.onCompleted() and then displaying a progressbar and also fill in the data while I'm retrieving it from the external sensors, so that the user can see whats going on and on his/her discretion also cancel the whole process.

        Starting this activity from within Component.onCompleted() works fine except that I don't see the new screen, progress bar etc. until everything is done (I do call QApplication::processEvents() frequently, while I'm waiting for the hardware init to complete).

        It's not a big problem, there are ways to work around this. Just thought that there might be some signal or method to know once all QML components are ready and visible.

        1 Reply Last reply
        0
        • G Offline
          G Offline
          Gennon
          wrote on last edited by
          #4

          First off the Loader has a "progress":http://qt-project.org/doc/qt-5/qml-qtquick-loader.html#progress-prop and a "status":http://qt-project.org/doc/qt-5/qml-qtquick-loader.html#status-prop property that you could use.

          However if you have some sensors and C++ objects then you could always let those objects emit some signals while they process the data. And you could use a "Connections":http://qt-project.org/doc/qt-5/qml-qtqml-connections.html element in your QML to catch those.

          Does this help in any way?

          /Gen

          1 Reply Last reply
          0
          • M Offline
            M Offline
            micha-
            wrote on last edited by
            #5

            not really. Just tried the signals and status info of the Loader component, but it seems that those signals are also emitted just before the new screen visible. I think I'll do my UI a bit differently to avoid this kind of issues.
            Nevertheless: THANKS for helping!

            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