KPushButton and deprecated setIcon ?

David Faure faure at kde.org
Mon Feb 20 10:51:32 GMT 2012


On Sunday 19 February 2012 12:29:24 Martin Koller wrote:
> Hi,
> 
> I'm developing a new KDE application and use designer for the UI.
> In designer I can set the icon for a KPushButton to a name in the field
> "Theme" which results in a call to
>         QIcon icon(QIcon::fromTheme(QString::fromUtf8("contact-new")));
>         newCustomer->setIcon(icon);
> However I get a compiler warning due to setIcon being defined as deprecated
> with the following comment:
> 
>      * Sets the pixmap for this button. Rarely used. This one exists mostly
> for usage in Qt designer, * with icons embedded into the ui file. But you
> should rather save them separately, and load them * with KIcon("name") so
> that the icons are themeable.
>      */
> #ifndef KDE_NO_DEPRECATED
>     KDE_DEPRECATED void setIcon( const QIcon &pix );
> 
> I assume this deprecation was done before Qt itself had the possibility to
> load an icon from a theme ?

Sounds right.

> So should the KDE_DEPRECATED be simply removed ?

Yep, please do (this is also in line with the direction of KDE Frameworks).

-- 
David Faure, faure at kde.org, http://www.davidfaure.fr
Sponsored by Nokia to work on KDE, incl. KDE Frameworks 5





More information about the kde-core-devel mailing list