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. QML Canvas synchronization
Forum Updated to NodeBB v4.3 + New Features

QML Canvas synchronization

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
4 Posts 2 Posters 358 Views
  • 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.
  • F Offline
    F Offline
    Fede Devi
    wrote on last edited by
    #1

    I have a Qt Quick application that can run a series of tests and take multiple screenshots of itself in different states for quality control. Screenshots of the application are taken by calling QQuickWindow::grabWindow() on the root window and the different test pages are loaded with a loader and a list of ql source files / properties.
    Normal QML components are rendered synchronously and are visible in the screenshots as soon as the loader is ready. The problem is when one of the pages uses some custom Canvas drawing, in this case the loader become ready before the canvas is actually painted.

    Is there a way to delay the "object completion" in QML until painted() is called on the canvas so that the component loading is synchronized and I have a consistent behavior with the rest of the QML components. Or, more generally, is there a way to delay a QML "object completion" until a certain signal is triggered?

    I could trigger a signal on the object handling the screenshot logic from all the Canvas objects to synchronize it but it does not seem like a nice solution.
    I tried to change the render strategy of the canvas object but it doesn't really change anything, at least not on my platform (linux with software renderer).

    TY, Federico

    1 Reply Last reply
    0
    • GrecKoG Offline
      GrecKoG Offline
      GrecKo
      Qt Champions 2018
      wrote on last edited by
      #2

      Would delaying the screenshot for one render loop be enough?

      1 Reply Last reply
      1
      • F Offline
        F Offline
        Fede Devi
        wrote on last edited by
        #3

        We are currently delaying the scren grab for a set amount of time for the test cases that requires it, not an optimal solution but it works. I don't think delaying it for one render loop would be enough, is there away to do it anyway?

        1 Reply Last reply
        0
        • GrecKoG Offline
          GrecKoG Offline
          GrecKo
          Qt Champions 2018
          wrote on last edited by
          #4
          QTimer::singleShot(0, this, [=] {
              doTheScreenshot();
          });
          

          should do it.

          1 Reply Last reply
          1

          • Login

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • Users
          • Groups
          • Search
          • Get Qt Extensions
          • Unsolved