Scale icons returned by QIcon::fromTheme.
authorDavid Sansome <me@davidsansome.com>
Thu, 22 Mar 2012 11:28:29 +0000 (11:28 +0000)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Wed, 10 Oct 2012 06:45:22 +0000 (08:45 +0200)
commitc3ffcbd9a2697f1799ba4afbdf14ca1210ac2bbd
treedb32fd4c8acfc30fb2d7e6e77cdc3ef3a545e227
parent3d52d67096b0b3a427c085e5d84bcf13d16c1086
Scale icons returned by QIcon::fromTheme.

The icon engine behind icons that are loaded from QIcon::fromTheme does
not scale any pixmaps that it returns. When using an icon theme with an
incomplete set of icons (for example, only a "128x128" folder),
QIcon::pixmap will always return 128x128 pixmaps even if you ask for
one of size 22x22.

This is contrary to the QIcon::pixmap documentation that says "The
pixmap might be smaller than requested, but never larger."

This patch uses the same code that is in the main QIcon class in the
PixmapEntry QIconLoaderEngineEntry to scale pixmaps if they are too big.

Change-Id: Ic25a3628ac82cfb899574245f658490a2dd49d54
Reviewed-by: Jens Bache-Wiig <jens.bache-wiig@digia.com>
src/gui/image/qiconloader.cpp
tests/auto/gui/image/qicon/tst_qicon.cpp