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. Extreme Performance Hit With Overlapped QGraphicItems
QtWS25 Last Chance

Extreme Performance Hit With Overlapped QGraphicItems

Scheduled Pinned Locked Moved Unsolved General and Desktop
performancebest practice
4 Posts 2 Posters 979 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.
  • V Offline
    V Offline
    Victor M
    wrote on 16 Apr 2018, 17:46 last edited by
    #1

    Hi, I'm new to Qt and wanted to find out what is the best approach with handling overlapped QGraphicsItems?

    As an example, I slightly modified the 40k Chips Qt example where I set the same position for each chip. Qt is able to add the items into the scene but goes unresponsive by displaying a white (blank) window since I assume it's overloaded with recursive paint calls where the window never recovers. Is there a preferred approach (and/or best practice) with having QT only paint the topmost item?

    1 Reply Last reply
    0
    • M Offline
      M Offline
      mrjj
      Lifetime Qt Champion
      wrote on 16 Apr 2018, 17:50 last edited by mrjj
      #2

      Hi and welcome to the forums.
      If you stack all 40.000 on top it will be heavy as then all needs redrawing
      as all is visible at same time.
      What is the use case ?
      Do you really need to handle such massive amount of objects at same time?

      V 1 Reply Last reply 17 Apr 2018, 17:42
      0
      • M mrjj
        16 Apr 2018, 17:50

        Hi and welcome to the forums.
        If you stack all 40.000 on top it will be heavy as then all needs redrawing
        as all is visible at same time.
        What is the use case ?
        Do you really need to handle such massive amount of objects at same time?

        V Offline
        V Offline
        Victor M
        wrote on 17 Apr 2018, 17:42 last edited by
        #3

        @mrjj The use case is having an graphical window where users can create entity objects so there could be a possibility of overlapped objects, either at the same location or their graphical shape being overlapped. With having a zoom out feature, these objects have a greater chance to overlap.

        Yes, I agree that in my example is an extreme case and I don't see a use case with that many objects. However, is a performance hit is noticeable the more objects exist so my posting is looking for any measures to help alleviate unnecessary painting.

        M 1 Reply Last reply 17 Apr 2018, 19:02
        0
        • V Victor M
          17 Apr 2018, 17:42

          @mrjj The use case is having an graphical window where users can create entity objects so there could be a possibility of overlapped objects, either at the same location or their graphical shape being overlapped. With having a zoom out feature, these objects have a greater chance to overlap.

          Yes, I agree that in my example is an extreme case and I don't see a use case with that many objects. However, is a performance hit is noticeable the more objects exist so my posting is looking for any measures to help alleviate unnecessary painting.

          M Offline
          M Offline
          mrjj
          Lifetime Qt Champion
          wrote on 17 Apr 2018, 19:02 last edited by mrjj
          #4

          @Victor-M
          Ah, fair enough. performance testing is always wise.
          Did you read about
          http://doc.qt.io/qt-5/qgraphicsitem.html#CacheMode-enum ?
          Depending on the complexity of the paint function of the objects, this might
          be useful. (AFAIK)
          have you tested with
          http://doc.qt.io/qt-5/qtwidgets-graphicsview-diagramscene-example.html
          and and few very happy copy & paste moments to get a fair amount ? (just a thought, its a similar usecase-ish)

          1 Reply Last reply
          0

          4/4

          17 Apr 2018, 19:02

          • Login

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