Qt Quick Designer: Enable HighDPI items in ItemLibrary

Item library icons and the drag pixmap could be avalible as
@2x variants.

Change-Id: Ice2254e769351fe4b715f911b3c14aa61813636c
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
This commit is contained in:
Alessandro Portale
2015-12-08 11:56:08 +01:00
parent 44958cad22
commit b242c100cb
2 changed files with 5 additions and 2 deletions

View File

@@ -24,6 +24,8 @@
****************************************************************************/ ****************************************************************************/
#include "itemlibraryimageprovider.h" #include "itemlibraryimageprovider.h"
#include <utils/stylehelper.h>
namespace QmlDesigner { namespace QmlDesigner {
namespace Internal { namespace Internal {
@@ -35,7 +37,7 @@ ItemLibraryImageProvider::ItemLibraryImageProvider() :
QPixmap ItemLibraryImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize) QPixmap ItemLibraryImageProvider::requestPixmap(const QString &id, QSize *size, const QSize &requestedSize)
{ {
QPixmap pixmap(id); const QPixmap pixmap(Utils::StyleHelper::dpiSpecificImageFile(id));
if (size) { if (size) {
size->setWidth(pixmap.width()); size->setWidth(pixmap.width());
size->setHeight(pixmap.height()); size->setHeight(pixmap.height());

View File

@@ -356,7 +356,8 @@ void ItemLibraryWidget::startDragAndDrop(QVariant itemLibraryId)
QMimeData *mimeData = m_itemLibraryModel->getMimeData(m_currentitemLibraryEntry); QMimeData *mimeData = m_itemLibraryModel->getMimeData(m_currentitemLibraryEntry);
QDrag *drag = new QDrag(this); QDrag *drag = new QDrag(this);
drag->setPixmap(m_currentitemLibraryEntry.libraryEntryIconPath()); drag->setPixmap(Utils::StyleHelper::dpiSpecificImageFile(
m_currentitemLibraryEntry.libraryEntryIconPath()));
drag->setMimeData(mimeData); drag->setMimeData(mimeData);
drag->exec(); drag->exec();