┌   ┐
54
└   ┘

summaryrefslogtreecommitdiff
path: root/src/kitemviews/kstandarditemlistwidget.cpp
diff options
context:
space:
mode:
authorFrank Reininghaus <[email protected]>2013-08-15 00:15:51 +0200
committerFrank Reininghaus <[email protected]>2013-08-15 00:15:51 +0200
commit6bfa0ccfc701df5af5f043fce3168b3840858212 (patch)
treea978d69d1afbd237cf5a3f8e8e117fbbab71adb2 /src/kitemviews/kstandarditemlistwidget.cpp
parent68520f55f0b6b2fc450f646477bf3c535324aa2b (diff)
parent7c99a9c2ad4455c65a218c53dfa7f6376f389b66 (diff)
Merge remote-tracking branch 'origin/KDE/4.11'
Diffstat (limited to 'src/kitemviews/kstandarditemlistwidget.cpp')
-rw-r--r--src/kitemviews/kstandarditemlistwidget.cpp38
1 files changed, 18 insertions, 20 deletions
diff --git a/src/kitemviews/kstandarditemlistwidget.cpp b/src/kitemviews/kstandarditemlistwidget.cpp
index b429211b8..2a89004c6 100644
--- a/src/kitemviews/kstandarditemlistwidget.cpp
+++ b/src/kitemviews/kstandarditemlistwidget.cpp
@@ -791,7 +791,6 @@ void KStandardItemListWidget::updateExpansionArea()
{
if (m_supportsItemExpanding) {
const QHash<QByteArray, QVariant> values = data();
- Q_ASSERT(values.contains("expandedParentsCount"));
const int expandedParentsCount = values.value("expandedParentsCount", 0).toInt();
if (expandedParentsCount >= 0) {
const qreal widgetHeight = size().height();
@@ -839,29 +838,14 @@ void KStandardItemListWidget::updatePixmapCache()
// use a generic icon as fallback
iconName = QLatin1String("unknown");
}
- m_pixmap = pixmapForIcon(iconName, maxIconHeight);
+ const QStringList overlays = values["iconOverlays"].toStringList();
+ m_pixmap = pixmapForIcon(iconName, overlays, maxIconHeight);
} else if (m_pixmap.width() != maxIconWidth || m_pixmap.height() != maxIconHeight) {
// A custom pixmap has been applied. Assure that the pixmap
// is scaled to the maximum available size.
KPixmapModifier::scale(m_pixmap, QSize(maxIconWidth, maxIconHeight));
}
- const QStringList overlays = values["iconOverlays"].toStringList();
-
- // Strangely KFileItem::overlays() returns empty string-values, so
- // we need to check first whether an overlay must be drawn at all.
- // It is more efficient to do it here, as KIconLoader::drawOverlays()
- // assumes that an overlay will be drawn and has some additional
- // setup time.
- foreach (const QString& overlay, overlays) {
- if (!overlay.isEmpty()) {
- // There is at least one overlay, draw all overlays above m_pixmap
- // and cancel the check
- KIconLoader::global()->drawOverlays(overlays, m_pixmap, KIconLoader::Desktop);
- break;
- }
- }
-
if (m_isCut) {
KIconEffect* effect = KIconLoader::global()->iconEffect();
m_pixmap = effect->apply(m_pixmap, KIconLoader::Desktop, KIconLoader::DisabledState);
@@ -1323,9 +1307,9 @@ void KStandardItemListWidget::closeRoleEditor()
m_roleEditor = 0;
}
-QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, int size)
+QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, const QStringList& overlays, int size)
{
- const QString key = "KStandardItemListWidget:" % name % ":" % QString::number(size);
+ const QString key = "KStandardItemListWidget:" % name % ":" % overlays.join(":") % ":" % QString::number(size);
QPixmap pixmap;
if (!QPixmapCache::find(key, pixmap)) {
@@ -1355,6 +1339,20 @@ QPixmap KStandardItemListWidget::pixmapForIcon(const QString& name, int size)
KPixmapModifier::scale(pixmap, QSize(size, size));
}
+ // Strangely KFileItem::overlays() returns empty string-values, so
+ // we need to check first whether an overlay must be drawn at all.
+ // It is more efficient to do it here, as KIconLoader::drawOverlays()
+ // assumes that an overlay will be drawn and has some additional
+ // setup time.
+ foreach (const QString& overlay, overlays) {
+ if (!overlay.isEmpty()) {
+ // There is at least one overlay, draw all overlays above m_pixmap
+ // and cancel the check
+ KIconLoader::global()->drawOverlays(overlays, pixmap, KIconLoader::Desktop);
+ break;
+ }
+ }
+
QPixmapCache::insert(key, pixmap);
}