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. Deleting QGraphicsItem very slow
Forum Updated to NodeBB v4.3 + New Features

Deleting QGraphicsItem very slow

Scheduled Pinned Locked Moved General and Desktop
3 Posts 1 Posters 902 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.
  • I Offline
    I Offline
    imoir
    wrote on last edited by
    #1

    I am having problems deleting large numbers of QGraphicsItems. In one case, it takes about 30 seconds to create 100,000 QGraphicsItems put into 11 QGraphicsItemGroups, but it takes about 90 seconds to delete all these items. That is a long time for the user to wait unloading one document to then load a new one. Has anyone else noticed slowness deleting QGraphicsItems? Has anyone found a way around it?

    Looking at the QGraphicsItem code, it might just be that all the checking in the destructor takes a longer time than setting up a simple QGraphicsItem. The solution I am contemplating is to delete all these items in a background thread.

    1 Reply Last reply
    0
    • I Offline
      I Offline
      imoir
      wrote on last edited by
      #2

      PS. In another example, creating 350,000 QGraphicsItems in 16 QGraphicsItemGroups takes 1 minute 15 seconds, but deleting them takes over 16 minutes.

      1 Reply Last reply
      0
      • I Offline
        I Offline
        imoir
        wrote on last edited by
        #3

        Doh! The QGraphicsItems were still part of a scene. I believed they were not. That explains the slowness.

        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