summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKai Uwe Broulik <[email protected]>2018-02-15 13:37:08 +0100
committerKai Uwe Broulik <[email protected]>2018-02-15 13:37:08 +0100
commitae67f991951e826ab6d0a6cb6e1123cf6ee35ca5 (patch)
tree483d0975e627d217bf02521c5df179dc6321895f
parent9a7569a82a29b00b0373892603791be1ab879e4d (diff)
[Information Panel] Adjust painting icons for high dpi scaling
Instead of creating our own KIconLoader (which takes ~5ms here) just use QIcon::fromTheme which already does everything right. BUG: 390488 Differential Revision: https://phabricator.kde.org/D10532
-rw-r--r--src/panels/information/informationpanelcontent.cpp23
1 files changed, 9 insertions, 14 deletions
diff --git a/src/panels/information/informationpanelcontent.cpp b/src/panels/information/informationpanelcontent.cpp
index 2e279dc..1575682 100644
--- a/src/panels/information/informationpanelcontent.cpp
+++ b/src/panels/information/informationpanelcontent.cpp
@@ -171,11 +171,9 @@ void InformationPanelContent::showItem(const KFileItem& item)
if (isSearchUrl) {
// in the case of a search-URL the URL is not readable for humans
// (at least not useful to show in the Information Panel)
- KIconLoader iconLoader;
- QPixmap icon = iconLoader.loadIcon(QStringLiteral("nepomuk"),
- KIconLoader::NoGroup,
- KIconLoader::SizeEnormous);
- m_preview->setPixmap(icon);
+ m_preview->setPixmap(
+ QIcon::fromTheme(QStringLiteral("nepomuk")).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous)
+ );
} else {
// try to get a preview pixmap from the item...
@@ -235,11 +233,9 @@ void InformationPanelContent::showItems(const KFileItemList& items)
m_previewJob->kill();
}
- KIconLoader iconLoader;
- QPixmap icon = iconLoader.loadIcon(QStringLiteral("dialog-information"),
- KIconLoader::NoGroup,
- KIconLoader::SizeEnormous);
- m_preview->setPixmap(icon);
+ m_preview->setPixmap(
+ QIcon::fromTheme(QStringLiteral("dialog-information")).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous)
+ );
setNameLabelText(i18ncp("@label", "%1 item selected", "%1 items selected", items.count()));
if (m_metaDataWidget) {
@@ -324,10 +320,9 @@ void InformationPanelContent::showIcon(const KFileItem& item)
{
m_outdatedPreviewTimer->stop();
if (!applyPlace(item.targetUrl())) {
- const QPixmap icon = KIconLoader::global()->loadIcon(item.iconName(), KIconLoader::Desktop,
- KIconLoader::SizeEnormous, KIconLoader::DefaultState,
- item.overlays());
- m_preview->setPixmap(icon);
+ QPixmap pixmap = QIcon::fromTheme(item.iconName()).pixmap(KIconLoader::SizeEnormous, KIconLoader::SizeEnormous);
+ KIconLoader::global()->drawOverlays(item.overlays(), pixmap, KIconLoader::Desktop);
+ m_preview->setPixmap(pixmap);
}
}