KIcon API replacement (Re: patches on kcolors)

Kevin Ottens ervin at kde.org
Thu Mar 15 18:53:36 UTC 2012


On Saturday 10 March 2012 13:03:10 David Faure wrote:
> On Saturday 10 March 2012 11:49:21 David Faure wrote:
> > Maybe we want to make it a method of
> > KIconLoader/KIconEngine instead?
> 
> KIconLoader::loadIcon is already taken (and returns a QPixmap), and
> KIconEngine is an internal class.
> 
> So a new suggestion would be:
> 
> namespace KDE {
>   QIcon loadIcon(const QString& iconName, KIconLoader* iconLoader = 0, const
> QStringList& overlays = QStringList());
> }

Looks good to me. We probably want also an overload without the iconLoader 
parameter I guess.

***
As a bonus, the crazy idea of the day:
What about making an exception to the casing rule for naming in cases like 
that (not excluding there's more than K/QIcon matching that pattern) and going 
for:
namespace KDE {
    QIcon Icon(...);
}

Client code would then look like:
QIcon i = KDE::Icon("foo");
instead of:
QIcon i = KDE::loadIcon("foo");

(I personally think it conveys better the idea as it makes it feel almost like 
a prototype object)
***

> Doesn't help finding out which header file it would come from, though.
> But hopefully, this being in kiconloader.h wouldn't be a big surprise.

Definitely not surprising to find it in kiconloader.h IMO. OK, maybe a bit 
more surprising with my proposal above though.

Regards.
-- 
Kévin Ottens, http://ervin.ipsquad.net

KDAB - proud patron of KDE, http://www.kdab.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: This is a digitally signed message part.
URL: <http://mail.kde.org/pipermail/kde-frameworks-devel/attachments/20120315/0f8cd620/attachment.sig>


More information about the Kde-frameworks-devel mailing list