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 Scene not repainting
Forum Updated to NodeBB v4.3 + New Features

QML Scene not repainting

Scheduled Pinned Locked Moved Unsolved QML and Qt Quick
3 Posts 2 Posters 423 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.
  • A Offline
    A Offline
    Asperamanca
    wrote on last edited by Asperamanca
    #1

    I am using QQmlIncubator and QQmlIncubationController to create QML components dynamically. Each component is currently just a Rectangle with a position, size and color. Each Rectangle is assigned the root QQuickItem as parentItem.

    As long as the number of incubated items is low, everything works fine and displays correctly.

    As soon as I incubate thousands of items (and have to call QQmlIncubationController::incubateFor multiple times inside a timer event), the scene simply stops to paint, i.e. none of the dynamically created items is visible.

    It seems to be a repaint issue, because when I attach GammaRay to inspect the scene, suddenly everything paints correctly. But of course, this is not a solution that I can use daily...

    I have tried the following things to force a repaint:

    • Call QQuickItem::update on each item as it's incubation finishes
    • Hide and Show the QQuickView once the incubation object count reaches zero

    Do you have any other ideas what I might try?

    A 1 Reply Last reply
    0
    • A Asperamanca

      I am using QQmlIncubator and QQmlIncubationController to create QML components dynamically. Each component is currently just a Rectangle with a position, size and color. Each Rectangle is assigned the root QQuickItem as parentItem.

      As long as the number of incubated items is low, everything works fine and displays correctly.

      As soon as I incubate thousands of items (and have to call QQmlIncubationController::incubateFor multiple times inside a timer event), the scene simply stops to paint, i.e. none of the dynamically created items is visible.

      It seems to be a repaint issue, because when I attach GammaRay to inspect the scene, suddenly everything paints correctly. But of course, this is not a solution that I can use daily...

      I have tried the following things to force a repaint:

      • Call QQuickItem::update on each item as it's incubation finishes
      • Hide and Show the QQuickView once the incubation object count reaches zero

      Do you have any other ideas what I might try?

      A Offline
      A Offline
      Asperamanca
      wrote on last edited by
      #2

      @Asperamanca
      If anyone stumbles upon this in the future: Instead of using a slot to continue incubation, I simply used a lambda directly connected to the timer. I suspect that this lambda was not executed in the correct thread, and caused the issue.

      1 Reply Last reply
      0
      • fcarneyF Offline
        fcarneyF Offline
        fcarney
        wrote on last edited by
        #3

        For dynamic objects look into Repeater and views with delegates. For non-item based objects look into Instantiator.
        A lot of the views are more efficient if all of the Items you create are not visible at the same time. The advantage of these is they can all work from a model object from either QAbstractListModel (and other abstract models) or ListModel. I use Repeater to show items on a map.

        C++ is a perfectly valid school of magic.

        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