Commit e8e3c0f8 authored by Andrew Crouthamel's avatar Andrew Crouthamel Committed by Henrik Fehlauer

Fix pixelated icon scaling for HiDPI screens

Summary:
This enables HiDPI pixmaps in the main window. This commit also replaces QPixmap and KIconLoader with QIcon to load properly scaled icons in the tree menu for HiDPI screens.

BUG: 390737

Before:
{F5764274}

After:
{F5764275}

Test Plan:
Open icon selection in main window.
Expand tree menu and ensure selection works.

Reviewers: rkflx, broulik, davidedmundson

Reviewed By: rkflx, davidedmundson

Subscribers: davidedmundson, cfeck, ngraham, plasma-devel

Tags: #plasma

Differential Revision: https://phabricator.kde.org/D11631
parent d094ef96
......@@ -59,6 +59,7 @@ extern "C" int Q_DECL_EXPORT kdemain( int argc, char **argv )
migrate.setUiFiles(QStringList() << QStringLiteral("kmenueditui.rc"));
migrate.migrate();
QGuiApplication::setAttribute(Qt::AA_UseHighDpiPixmaps);
KLocalizedString::setApplicationDomain("kmenuedit");
KAboutData aboutData(QStringLiteral("kmenuedit"), i18n("KDE Menu Editor"),
......
......@@ -29,7 +29,7 @@
#include <QHeaderView>
#include <QPainter>
#include <QRegExp>
#include <QPixmap>
#include <QIcon>
#include <QDropEvent>
#include <QMenu>
#include <QApplication>
......@@ -225,13 +225,6 @@ bool TreeItem::isLayoutDirty() const
return false;
}
static QPixmap appIcon(const QString &iconName)
{
QPixmap normal = KIconLoader::global()->loadIcon(iconName, KIconLoader::Small, 0, KIconLoader::DefaultState, QStringList(), 0L, true);
return normal;
}
TreeView::TreeView( KActionCollection *ac, QWidget *parent, const char *name )
: QTreeWidget(parent), m_ac(ac), m_popupMenu(0), m_clipboard(0),
m_clipboardFolderInfo(0), m_clipboardEntryInfo(0),
......@@ -432,7 +425,7 @@ TreeItem *TreeView::createTreeItem(TreeItem *parent, QTreeWidgetItem *after, Men
item->setMenuFolderInfo(folderInfo);
item->setName(folderInfo->caption);
item->setIcon(0, appIcon(folderInfo->icon));
item->setIcon(0, QIcon::fromTheme(folderInfo->icon));
item->setDirectoryPath(folderInfo->fullId);
item->setHiddenInMenu(folderInfo->hidden);
item->load();
......@@ -465,7 +458,7 @@ TreeItem *TreeView::createTreeItem(TreeItem *parent, QTreeWidgetItem *after, Men
////qDebug() << parent << after << name;
item->setMenuEntryInfo(entryInfo);
item->setName(name);
item->setIcon(0, appIcon(entryInfo->icon));
item->setIcon(0, QIcon::fromTheme(entryInfo->icon));
item->setHiddenInMenu(hidden);
item->load();
......@@ -687,7 +680,7 @@ void TreeView::currentDataChanged(MenuFolderInfo *folderInfo)
}
item->setName(folderInfo->caption);
item->setIcon(0, appIcon(folderInfo->icon));
item->setIcon(0, QIcon::fromTheme(folderInfo->icon));
}
void TreeView::currentDataChanged(MenuEntryInfo *entryInfo)
......@@ -710,7 +703,7 @@ void TreeView::currentDataChanged(MenuEntryInfo *entryInfo)
}
item->setName(name);
item->setIcon(0, appIcon(entryInfo->icon));
item->setIcon(0, QIcon::fromTheme(entryInfo->icon));
}
QStringList TreeView::fileList(const QString& rPath)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment