mirror of
https://bitbucket.org/smil3y/kdelibs.git
synced 2025-02-24 02:42:48 +00:00
kdeui: add scaled-down pixmap from KStatusNotifierItemPrivate::iconToVector() as fallback
because the status notifier data engine (see kde-workspace/plasma/dataengines/statusnotifieritem/statusnotifieritemsource.cpp) assumes that pixmaps are not larger than KIconLoader::SizeLarge Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
parent
efe1b03f30
commit
c5521e791f
1 changed files with 11 additions and 3 deletions
|
@ -912,14 +912,22 @@ KDbusImageVector KStatusNotifierItemPrivate::iconToVector(const QIcon &icon)
|
|||
|
||||
QPixmap iconPixmap;
|
||||
|
||||
//if an icon exactly that size wasn't found don't add it to the vector
|
||||
foreach (const QSize &size, icon.availableSizes()) {
|
||||
//hopefully huge and enormous not necessary right now, since it's quite costly
|
||||
bool imageAdded = false;
|
||||
const QList<QSize> availableSizes = icon.availableSizes();
|
||||
foreach (const QSize &size, availableSizes) {
|
||||
// hopefully huge and enormous not necessary right now since it's quite costly
|
||||
if (size.width() <= KIconLoader::SizeLarge) {
|
||||
imageAdded = true;
|
||||
iconPixmap = icon.pixmap(size);
|
||||
iconVector.append(imageToStruct(iconPixmap.toImage()));
|
||||
}
|
||||
}
|
||||
if (!imageAdded && !availableSizes.isEmpty()) {
|
||||
// but if only enormous size is available scale it down and add that, this happens to be
|
||||
// the case for some window icons
|
||||
iconPixmap = icon.pixmap(KIconLoader::SizeLarge);
|
||||
iconVector.append(imageToStruct(iconPixmap.toImage()));
|
||||
}
|
||||
|
||||
return iconVector;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue