[Kmymoney-devel] setUpdatesEnabled again

Cristian Oneţ onet.cristian at gmail.com
Sun Aug 16 08:09:52 CEST 2009


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

> 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


More information about the KMyMoney-devel mailing list