I have a QFrame that is used to paint some rectangles to represent some periods of the day, for example, the period when the user was sleeping.
To do so I overwrite the paintEvent(QPaintEvent *) function and I'm using a QPainter to paint the rectangles.
It is working fine, the problem is that the paintEvent(QPaintEvent *) function is automatically called multiple times by Qt to repaint the QFrame and it is consuming too much CPU. Actually, I just need to repaint a few times (by manually calling the repaint function).
There is some way that I can avoid the QFrame to automatically repaint itself?
Thanks in advance
I'm using Qt 5.3
if (anythinghasChanged){...}to yourpaintEvent()- 463035818_is_not_a_numberQFrameis erased (automatically) and it is not repainted again. - KelvinS