Revision 4433027...

Go back to digest for 1st September 2013

Features in KDE Base

Martin Klapetek committed changes in [kdelibs/frameworks] /kguiaddons:

Add utility function to paint icon overlays

As this was rejected from QIcon, I decided to implement it in
frameworks. The idea is new private icon engine (KOverlayIconEngine),
which paints the overlays itself, and then an utility function in
KIconUtils namespace, which takes the base icon and the overlay icons as
parameters and constructs new QIcon using KOverlayIconEngine.

As QPixmapIconEngine (QIcon default) is private in Qt and couldn't be
simply extended, the KOverlayIconEngine simply forwards the calls to
QIcon, which then forwards those calls internally to QPixmapIconEngine
(QIcon is really mostly just a wrapper around an engine).

There are two functions

QIcon KIconUtils::kIconAddOverlay(const QIcon &icon, const QIcon
&overlay, Qt::Corner position);

and

QIcon KIconUtils::kIconAddOverlay(const QIcon &icon, QHash<Qt::Corner,
QIcon> overlays);

The first one serves for single overlay icon, the second one is then for
multiple overlays, requires the QHash to be built up before passing
though.

REVIEW: 112079
DIGEST

File Changes

Added 4 files
  • /kguiaddons
  •   staging/autotests/kiconutilstest.cpp
  •   staging/autotests/kiconutilstest.h
  •   staging/src/lib/util/kiconutils.cpp
  •   staging/src/lib/util/kiconutils.h
Modified 2 files
  • /kguiaddons
  •   staging/autotests/CMakeLists.txt
  •   staging/src/lib/CMakeLists.txt
6 files changed in total