Extreme Performance Hit With Overlapped QGraphicItems



  • 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?


  • Qt Champions 2017

    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?



  • @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.


  • Qt Champions 2017

    @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)


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.