[Kmymoney-devel] setUpdatesEnabled again

Alvaro Soliverez asoliverez at gmail.com
Sun Aug 16 20:06:29 CEST 2009


On Sun, Aug 16, 2009 at 10:34 AM, Alvaro Soliverez <asoliverez at gmail.com>wrote:

>
>
> On Sun, Aug 16, 2009 at 3:09 AM, Cristian Oneţ <onet.cristian at gmail.com>wrote:
>
>> On Sun, Aug 16, 2009 at 3:12 AM, Alvaro Soliverez<asoliverez at gmail.com>
>> wrote:
>> > Hello all,
>> > I ran into the setUpdatesEnabled problem again.
>> >
>> > In the kbudgetview, both lists there call setUpdatesEnabled(false), fill
>> in
>> > the contents, then call setUpdatesEnabled(true) and repaintContents().
>> If you try leaving the setUpdatesEnabled calls but instead of
>> repaintContents() you use updateContents() what happens?
>
>
> updateContents() is protected. I tried update() instead, but no luck.
>
>
>> The Qt doc
>> suggests that calling repaint() (which repaintContents() does)
>> directly is not recommended and instead update() should be called
>> because "...is better, as it permits Qt to optimize for speed and
>> minimize flicker". But calling setUpdatesEnabled(true) implicitly
>> calls update on the widget so maybe repaintContents() or
>> updateContents() should not be used. This can be seen in the
>> difference between:
>> http://doc.trolltech.com/3.3/qwidget.html#updatesEnabled-prop
>> http://doc.trolltech.com/4.5/qwidget.html#updatesEnabled-prop
>> The qt3 example has a repaint after setUpdatesEnabled(true) while the
>> qt4 example doe not have anything after setUpdatesEnabled(true).
>>
>
> Yes, I tried also without anything after setUpdatesEnabled. And you are
> right, we should remove the repaintContents because it is supposed to call
> update() anyway.
>
>
>>
>> > Both lists don't show on the screen until I click on a column or an
>> item. If
>> > I remove the setUpdatesEnabled call, they work fine.
>> >
>> > I thought it might be that a parent widget might be calling it too, but
>> my
>> > search returned empty.
>> > Do you know where the problem might be?
>> >
>> > I think this might be the same problem that the accounts and categories
>> > views are having.
>> Another thing caught my attention in the difference between the
>> documentation in qt3 and qt4 of the updatesEnabled property. In qt4 it
>> is mentioned that "In Qt, widgets normally do not generate screen
>> flicker, but on X11 the server might erase regions on the screen when
>> widgets get hidden before they can be replaced by other widgets.
>> Disabling updates solves this.". But this was not mentioned in the qt3
>> doc so my suggestion would be to remove the calls to setUpdatesEnabled
>> and add them only in places where we observe that it is really
>> necessary.
>>
>> Regards,
>> Cristian
>>
>> P.S: I don't have access to my development environment above I was
>> just guessing, sorry if it's only noise
>>
>
> Your comments match what I see. So far, removing the call makes it work
> better. I guess that for some cases, like the register, we will have to deal
> with it. But in most cases, with only a couple of dozen items at most, we
> can do without  setUpdatesEnabled, at least for now.
>


I removed the setUpdatesEnabled call for all the views that were not working
ok, and now they all show up correctly. I commented the lines, so that if we
find problems in a future, we remember why it might be.

Regards,
Alvaro
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.kde.org/pipermail/kmymoney-devel/attachments/20090816/597b4784/attachment.htm 


More information about the KMyMoney-devel mailing list