[PATCH] Speed up iconView's setIcons 2x...
David Faure
david at mandrakesoft.com
Thu Aug 29 11:58:18 BST 2002
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
On Wednesday 28 August 2002 21:35, Koos Vriezen wrote:
> On Wed, 28 Aug 2002, David Faure wrote:
>
> > Oh, ok, cool. No objections to this patch begin applied then.
>
> Hmmm ... is it mine or your english :)
Oops, s/begin/being/
> /*!
> This slot is used for a slightly-delayed update.
>
> The icon view is not redrawn immediately after inserting a new item
> but after a very small delay using a QTimer. This means that when
> many items are inserted in a loop the icon view is probably redrawn
> only once at the end of the loop. This makes the insertions both
> flicker-free and faster.
> */
...... as long as nothing else forces an immediate repaint, indeed.
> This timer appears to be started in 'QIconView::insertItem'.
> So, as Lars said before in this thread, always call arrangeItemsInGrid
> with 'false' and do an 'update()'. Maybe a call to 'sort' before 'update'
Only if this means QIconView won't re-do the sorting by itself.
> or call the protected 'slotUpdate' directly?
Doesn't sound very clean, but well...
> Anyways, the traces showed the repaints didn't come from the QIconView.
> Probably from some parent widget or layout manager. This is really hard to
> debug :(.
Indeed (especially with posted repaint events due to update()).
> The problem with 'only repaint when calling from a timer events' is that
> in some case you do want to repaint (eg. selectAll).
Right. But that's after the insertions, and we call repaint or update, I suppose,
so why is that a problem? Ah, you mean if we wanted to prevent updates from with
the iconview itself. Right.
> Maybe Qt should sort
> icons in drawContents when new icons are added after the last paint, but
but...?
Anyway, this solution sounds quite good to me.
- --
David FAURE, david at mandrakesoft.com, faure at kde.org
http://people.mandrakesoft.com/~david/
Contributing to: http://www.konqueror.org/, http://www.koffice.org/
KOffice-1.2-rc1 is out. ftp://ftp.kde.org/pub/kde/unstable/koffice-1.2-rc1/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE9bf5K72KcVAmwbhARAlV6AKCipo2sJyXQ6V772wVOe27ezTRYjACgjm2i
5I5jNYKn3FPjuLbbw8Br/nk=
=zmzK
-----END PGP SIGNATURE-----
More information about the kfm-devel
mailing list