Proposal to use QIcon in APIs in KF5.

Andreas Pakulat apaku at gmx.de
Wed Sep 7 07:17:31 BST 2011


On 07.09.11 02:57:29, Tomaz Canabrava wrote:
> On Wed, Sep 7, 2011 at 2:53 AM, Boudewijn Rempt <boud at valdyas.org> wrote:
> > On Wednesday 07 September 2011 Sep, John Layt wrote:
> >
> >> Porting a dozen or so lines from KIcon(foo) to KIconFactory::icon(foo) is
> >> nowhere near the effort
> >
> > Just to make sure that everyone has the right perspective on the size of any porting effort: Calligra alone has over 1200 of KIcon(foo) lines.  KUrl is used about 700 times. There's also about a thousand places where we use kde4_add_library, kde4_add_plugin or kde4_add_unit_test. Simple porting tasks suddenly become a big thing.
> 
> and how bad it is to port all functionality from KIcon to QIcon, and
> in the KIcon header , a simple
> 
> #include <QIcon>
> typedef KIcon QIcon
> 
> ?
> 
> then, no porting effort is necessary.

Except that this will break your app and not load the icons at all.
KIcon(const QString&) needs to be replaced with QIcon::fromTheme() since
the QIcon(const QString&) constructor has different semantics than the
KIcon one.

But indeed often the porting effort can be reduced by using well-written
porting scripts/apps which can do the necessary syntax changes instead
of having to do that manually.

Andreas





More information about the kde-core-devel mailing list