File 0001-Support-both-QString-and-QIcon-for-dragHelper-pixmap.patch of Package milou5.8671
From 816a923f7c05047391834fc115c5da25563978f5 Mon Sep 17 00:00:00 2001
From: Kai Uwe Broulik <kde@privat.broulik.de>
Date: Wed, 8 Aug 2018 12:45:05 +0200
Subject: [PATCH] Support both QString and QIcon for dragHelper pixmap
The model was changed a while ago to return a QString if possible to have icon processing done in the delegate QML on-demand.
This broke the drag helper's drag pixmap, however, as the QML would pass in model.decoration which might be a string.
CHANGELOG: Fixed drag pixmap not showing when dragging results off KRunner's window
Differential Revision: https://phabricator.kde.org/D14545
---
lib/draghelper.cpp | 5 +++++
lib/draghelper.h | 2 ++
2 files changed, 7 insertions(+)
diff --git a/lib/draghelper.cpp b/lib/draghelper.cpp
index 571dee3..f720389 100644
--- a/lib/draghelper.cpp
+++ b/lib/draghelper.cpp
@@ -64,6 +64,11 @@ void DragHelper::startDrag(QQuickItem *item, QMimeData *mimeData, const QIcon &i
Q_ARG(QQuickItem*, item), Q_ARG(QMimeData*, mimeData), Q_ARG(QIcon, icon));
}
+void DragHelper::startDrag(QQuickItem *item, QMimeData *mimeData, const QString &iconName)
+{
+ startDrag(item, mimeData, QIcon::fromTheme(iconName));
+}
+
void DragHelper::doDrag(QQuickItem *item, QMimeData *mimeData, const QIcon &icon) const
{
QDrag *drag = new QDrag(item);
diff --git a/lib/draghelper.h b/lib/draghelper.h
index d68f967..bff8104 100644
--- a/lib/draghelper.h
+++ b/lib/draghelper.h
@@ -43,7 +43,9 @@ class MILOU_EXPORT DragHelper : public QObject
void setDragIconSize(int size);
Q_INVOKABLE bool isDrag(int oldX, int oldY, int newX, int newY) const;
+ // TODO KF6 merge the two
Q_INVOKABLE void startDrag(QQuickItem* item, QMimeData *mimeData, const QIcon &icon = QIcon());
+ Q_INVOKABLE void startDrag(QQuickItem* item, QMimeData *mimeData, const QString &iconName);
Q_SIGNALS:
void dragIconSizeChanged() const;
--
2.18.0