[Development] QtQuick - Automatically Repainting Canvas

Mitch Curtis mitch.curtis at digia.com
Thu Dec 12 13:18:37 CET 2013


On 12/11/2013 03:16 PM, Matthias Kleine wrote:
>> 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?

The former.

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

I'm not sure. Gunnar would know. I've just been told that it's not cheap 
and I've seen that it's easy to misuse. It's not hard (and actually 
kinda fun) separating out the parts that need to be rendered less often 
to avoid unnecessary repaints.

>> 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.
>
>
> Cheers,
>
> Matthias
>
>
>
> _______________________________________________
> Development mailing list
> Development at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/development
>



More information about the Development mailing list