[PATCH] Improve KShortcutDialog construction time
David Faure
faure at kde.org
Thu Apr 24 17:50:47 BST 2008
On Wednesday 23 April 2008, Robert Knight wrote:
> Hi,
>
> The attached patch series improves construction time of KShortcutEditor
> (and therefore KShortcutDialog) which currently feels quite slow in Kate
> and some other apps with a lot of shortcuts.
>
> The main problem is that when adding a new child to a QTreeWidgetItem,
> if the parent is associated with the view then the internal model will
> trigger various extra processing, particularly in the header view.
>
> This is fixed by creating the QTreeWidgetItems un-attached to the view
> and then adding them to the view's root when the widget is shown.
You should test !event->isSpontaneous() in your showEvent, otherwise
this code is going to trigger also when the window is shown-again after switching
desktops for instance.
> - (0009) Cache translated names for the shortcut item's display role to
> avoid creating new KLocalizedString instances every time. I'm not sure
> why this is translated in the first place since the text for the
> translation is just "%1" which is substituted by the action's text.
Ask svn annotate for who wrote this line; but indeed I can't see why a translator
would want to change this.
However this optimization seems superfluous to me - do you really gain anything
from this code obfuscation? Note that it also breaks runtime language change.
--
David Faure, faure at kde.org, sponsored by Trolltech to work on KDE,
Konqueror (http://www.konqueror.org), and KOffice (http://www.koffice.org).
More information about the kde-core-devel
mailing list