KIcon / KIconEngine

Hamish Rodda rodda at kde.org
Sun Mar 19 05:18:44 GMT 2006


Hi,

With the new one-icon-per-action-only design, there were troubles with loading 
the correct size of icon to display for an action.  (To be fair, this was 
partly due to KIconLoader still using QPixmaps).

As a solution, I've created two new classes, KIcon and KIconEngine, and 
renamed the old KIcon to K3Icon.  Some of these changes have been discussed 
on the mailing list before, but I just wanted to run them past everyone for 
comment before committing.

I've not included the whole patch, because most of the KIcon -> K3Icon diff is 
pretty mundane.  Instead, please find attached the new files, and the diff to 
kaction which allows the old deprecated way of setting icon names also use 
the new KIcon system.  One side effect of the patch is that it is not 
possible to get the kde icon name back from a kaction or qicon/kicon, because 
QIcon does not provide public access to the QIconEngine it uses.  I don't see 
this as a problem though.

At the moment the patch is suboptimal because KIcon should look to see if we 
have already created a corresponding KIconEngine for the specified icon name.  
This can be added later however.  Also planned for future development is 
switching KIconLoader to just supply file names, and have KIconEngine do the 
loading of the icon and (in the case of vector graphics) rendering as 
required.

I'd like this to go in before the next snapshot, so those porting to the new 
KAction can also provide a KIcon("iconname") instead of using deprecated 
constructors or the deprecated setIconName().

Cheers,
Hamish.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kicon.cpp
Type: text/x-c++src
Size: 1034 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060319/2a7bb39a/attachment.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kiconengine.cpp
Type: text/x-c++src
Size: 2789 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060319/2a7bb39a/attachment-0001.cpp>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kicon.h
Type: text/x-c++hdr
Size: 1654 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060319/2a7bb39a/attachment.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kiconengine.h
Type: text/x-c++hdr
Size: 1898 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060319/2a7bb39a/attachment-0001.h>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: kaction-kicon.patch
Type: text/x-diff
Size: 3054 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060319/2a7bb39a/attachment.patch>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://mail.kde.org/pipermail/kde-core-devel/attachments/20060319/2a7bb39a/attachment.sig>


More information about the kde-core-devel mailing list