[Development] QtQuick - Automatically Repainting Canvas

Matthias Kleine matthias_kleine at gmx.de
Wed Dec 11 15:16:37 CET 2013

> On 12/09/2013 05:42 PM, Matthias Kleine wrote:
> > is there an established pattern for repainting a canvas once a property
> > that is accessed during painting changes? If not, I suggest to add a
> > RepaintingCanvas. See the attachment for a naive implementation. Is
> > there a chance for something like this to be included in Qt?
> I usually just set up a Connections object. It can get a bit messy, but 
> at the same time you know exactly when it repaints, which is good when 
> you want to repaint as rarely as possible.
I agree that setting up Connection objects is messy. I also often find it redundant and therefore hard to maintain.
I'd like to understand why you worry about painting as rarely as possible. Are you afraid of performance problems or of painting an inconsistent state? Regarding the former, I was under the impression that multiple calls to "requestPaint" from one GUI-event would result in on repaint. Is that not correct?
> Does the attached implementation *constantly* request repaints? I know 
> you said that it's naive, I'm just trying to understand it.

It does request repaints for every property change. Why would this be a problem?
I described it as naive because it creates a new binding on every paint. It's possible to rewrite it so it doesn't do so.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131211/a023f9f0/attachment.html>

More information about the Development mailing list