Re: update and paintevent
Yes, in your case update() and update(QRegion) will behave the same as your painEvent() will redraw every thing. In a case where the widget has complex painting, and repainting all the widget is very costly, there update(QRegion) is used. For complex / slow painting widgets while imlementing paintEvent() only QPaintEvent::region() has to painted instead of all the widget.
Quote:
Originally Posted by Qt Docs
Many widgets can simply repaint their entire surface when asked to, but some slow widgets need to optimize by painting only the requested region: QPaintEvent::region(). This speed optimization does not change the result, as painting is clipped to that region during event processing. QListView and QTableView do this, for example
Qt also tries to speed up painting by merging multiple paint events into one. When update() is called several times or the window system sends several paint events, Qt merges these events into one event with a larger region (see QRegion::united()). The repaint() function does not permit this optimization, so we suggest using update() whenever possible.
Re: update and paintevent
thank you for the answer.
you mean that I need paint the region which returned by QPaintEvent::region() in my function paintEvent() myself ? Or QT does it?
Re: update and paintevent
Quote:
you mean that I need paint the region which returned by QPaintEvent::region() in my function paintEvent() myself ? Or QT does it?
Qt only determines which section of widget (i.e. QPaintEvent::region()) has to be re-painted, You need paint it yourself in paintEvent(). Note that it is not mandatory to do so, but will be useful in case where painting whole widget is slow.
Re: update and paintevent
thank you. I understand.
I thought too much.