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 disable drawing of QGraphicsItems
Forum Update on Monday, May 27th 2025

How to disable drawing of QGraphicsItems

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 1 Posters 262 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.
  • Q Offline
    Q Offline
    Qtstarter121
    wrote on last edited by Qtstarter121
    #1

    So I have a couple thousand QGraphicsItem objects being added to the scene and being drawn. All items are updated and added to the scene every 10 sec or so and this seems to cause a significant lag of up to 5 seconds on my GUI. I have searched all over the internet to find ways to improve performance including trying to set no indexing method to the scene, caching . I also tried grouping some of the items into a QGraphicsItemGroup because every update actually creates a few interrelated items and so it would make sense to just group them together so they are treated as one. This didn't actually help with the performance however. I'm now thinking of disabling any updates to the QGraphicsView that come from my QGraphicsScene but it doesn't seem very clear how you can do that because all I see is something called updatesEnabled() which will disable drawing on the entire QGraphicsView but I only want to disable drawing of certain items in the QGraphicsScene object and then resume the drawing when I want to later. The idea is to delay the drawing of my items on the view until all the thousands of items are updated and added to the scene. Any ideas on what I could try?

    1 Reply Last reply
    0
    • Q Offline
      Q Offline
      Qtstarter121
      wrote on last edited by
      #2

      I guess one way to do this would be to call setData on my items in the scene and add some meaningful tag to the items like some string to identify them and hide my items so they don't update and then when I want to resume updates( calling update on all items at one time) , I call items() in the scene, find the items I want to update and call update() on each item manually... any ideas on if I should expect a performance improvement in doing things this way?

      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