Results 1 to 2 of 2

Thread: QGraphicsWidgets erased slowly

  1. #1
    Join Date
    Mar 2019
    Qt products

    Default QGraphicsWidgets erased slowly


    I'm working on a QGraphicsScene application in Qt 5,12. In my scene, I have static and dynamic elements. I have two lists of texts on the two side of my screen, as sources and targets. In between them, I have dynamic circle elements which make a trajectory between the source and the target based on the time.

    My text item is a QGraphicsWidget in order to be able to stock them in a layout. I overrode the paint function of the QGraphicsWidget in which I call QGraphicsWidget:aint and I also draw a text using QPainter::drawText.

    My circle item inherits from QGraphicsEllipseItem and it has two pointers to its source and destination.

    By using a QTimer I update the position of my dynamic items so that they are moving from the source to the target.

    My problem is that slowly my texts become erased as the circles pass. Please look at the attached screenshot.

    I found a workaround to solve this problem by calling update on all of my text item when the timer times out.

    Another solution I found is to subclass QgraphicsLayoutItem instead of subclassing the QGraphicsWidget.

    Could you please someone explain me why in the first case my texts become erased?

    Attached Images Attached Images

  2. #2
    Join Date
    Mar 2019
    Qt products

    Default Re: QGraphicsWidgets erased slowly

    I have noticed that also when I resize my widow my texts are corrected, due to the update event.

    I've tried to change the ZValue of my elements because I thought that my texts are not visible due to a circle which masks them but even setting the ZValue does not solve the problem.

Similar Threads

  1. why Qt5.5.1 qDebug so slowly?
    By tiaoweiliao in forum Qt Programming
    Replies: 1
    Last Post: 16th May 2016, 09:23
  2. QGraphicsWidgets on QGraphicsGridLayout
    By onurozcelik in forum Qt Programming
    Replies: 4
    Last Post: 4th April 2010, 12:38
  3. Replies: 0
    Last Post: 16th November 2009, 16:16
  4. very slowly apps
    By swiety in forum Qt Programming
    Replies: 2
    Last Post: 20th January 2008, 11:05

Tags for this Thread


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.