Merge lp:~osomon/unity-2d/drag-from-dash into lp:unity-2d/3.0

Proposed by Olivier Tilloy
Status: Merged
Approved by: Florian Boucault
Approved revision: 571
Merged at revision: 579
Proposed branch: lp:~osomon/unity-2d/drag-from-dash
Merge into: lp:unity-2d/3.0
Diff against target: 543 lines (+426/-5)
10 files modified
launcher/UnityApplications/place.cpp (+2/-2)
launcher/app/launcherview.cpp (+1/-2)
libunity-2d-private/Unity2d/CMakeLists.txt (+4/-0)
libunity-2d-private/Unity2d/dragitem.cpp (+159/-0)
libunity-2d-private/Unity2d/dragitem.h (+77/-0)
libunity-2d-private/Unity2d/dragitemwithurl.cpp (+82/-0)
libunity-2d-private/Unity2d/dragitemwithurl.h (+62/-0)
libunity-2d-private/Unity2d/plugin.cpp (+2/-0)
places/AbstractButton.qml (+8/-1)
places/UnityDefaultRenderer.qml (+29/-0)
To merge this branch: bzr merge lp:~osomon/unity-2d/drag-from-dash
Reviewer Review Type Date Requested Status
Florian Boucault (community) code Needs Fixing
Review via email: mp+61438@code.launchpad.net

Commit message

[dash] Support dragging files and installed applications from the dash to the launcher, the desktop or file managers.

Description of the change

This branch introduces a new QML item, DragItemWithUrl, used in the dash to allow initiating drag events from the elements displayed in the places.

Installed applications and files can be dragged to the launcher, to the desktop or to any window that accepts drag events with "file://" URLs (e.g. file managers).

Available (non installed) applications cannot be dragged.

The careful reviewer will test that the functionality works as expected, that this doesn’t introduce regressions in the dash (in particular opening files/folders and launching applications) and in the launcher (drag’n’drop of desktop files from a file manager, drag’n’drop of files to the trash, drag’n’drop of URLs from the browser’s address bar).

To post a comment you must log in.
Revision history for this message
Florian Boucault (fboucault) wrote :

WARNING: THIS IS NOT A COMPLETE REVIEW

I did a quick functional test and it's pretty neat, well done!
One thing I noticed, the icons are very aliased whereas if I drag&drop an app in /usr/share/applications from Nautilus for example it will look antialiased. Any idea?

Revision history for this message
Olivier Tilloy (osomon) wrote :

No, unfortunately I have no idea how to improve this. The code is quite simple so I’m probably missing something obvious. Any suggestions are welcome.

lp:~osomon/unity-2d/drag-from-dash updated
568. By Olivier Tilloy

Nice antialiased icons during drag’n’drop if compositing is enabled.

569. By Olivier Tilloy

Cheap solution to avoid aliasing when compositiong is disabled: draw a solid white background.

Revision history for this message
Olivier Tilloy (osomon) wrote :

The last two revisions fix the aliasing problem. There are two possible cases:

 - if compositing is enabled, the icon is nicely antialiased, as one would expect
 - if compositing is disabled, the icon is drawn on a solid white background (with rounded corners to make it easier on the eye), so that aliasing is not visible

Comments on the fallback when compositing is disabled are welcome, we can probably implement something different if needed.

Revision history for this message
Florian Boucault (fboucault) wrote :

Functionally beautiful now!

review: Approve (functional)
Revision history for this message
Florian Boucault (fboucault) wrote :

Overall the code is nice and simple.
A few comments:

- a Component should be passed as DragItemWithUrl's delegate as to not create Image instances unless necessary. Instead of:

  DragItemWithUrl {
    delegate: Image {...}
  }

Use:

  DragItemWithUrl {
    delegate: imageComponentId
  }

  Component {
    id: imageComponentId
    Image {...}
  }

- DeclarativeDragItem::drop signal name should have a better name, for example 'dragInitiated'

- The workaround that has been added to AbstractButton could use a link to qt bug report 13007 that if I am right should remove the need for it in the future (http://bugreports.qt.nokia.com/browse/QTBUG-13007)

review: Needs Fixing (code)
lp:~osomon/unity-2d/drag-from-dash updated
570. By Olivier Tilloy

Made the delegate a Component so that it’s instantiated on demand only when needed.

571. By Olivier Tilloy

Add a comment and link to QTBUG-13007.

Revision history for this message
Olivier Tilloy (osomon) wrote :

> - a Component should be passed as DragItemWithUrl's delegate as to not create
> Image instances unless necessary. Instead of:

Thanks for pointing this out. I had originally tried to write it this way, but I had failed to do so. I tackled the problem again, this time successfully. This is revision 570.

> - DeclarativeDragItem::drop signal name should have a better name, for example
> 'dragInitiated'

Nope, it’s called 'drop' because it’s actually emitted upon dropping the dragged item, not when the drag action is initiated.

> - The workaround that has been added to AbstractButton could use a link to qt
> bug report 13007 that if I am right should remove the need for it in the
> future (http://bugreports.qt.nokia.com/browse/QTBUG-13007)

You’re right. Added at revision 571.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'launcher/UnityApplications/place.cpp'
2--- launcher/UnityApplications/place.cpp 2011-05-03 15:38:35 +0000
3+++ launcher/UnityApplications/place.cpp 2011-05-30 16:06:44 +0000
4@@ -429,8 +429,8 @@
5 /* Cannot set the desktop file to url.host(), because the QUrl constructor
6 converts the host name to lower case to conform to the Nameprep
7 RFC (see http://doc.qt.nokia.com/qurl.html#FormattingOption-enum).
8- Ref: http://bugs.launchpad.net/unity-2d/+bug/723604 */
9- QString desktopFile = uri.right(uri.size() - uri.indexOf("://") - 3);
10+ Ref: https://bugs.launchpad.net/unity-place-applications/+bug/784478 */
11+ QString desktopFile = uri.mid(uri.indexOf("://") + 3);
12 application.setDesktopFile(desktopFile);
13 application.activate();
14 return;
15
16=== modified file 'launcher/app/launcherview.cpp'
17--- launcher/app/launcherview.cpp 2011-05-19 14:12:41 +0000
18+++ launcher/app/launcherview.cpp 2011-05-30 16:06:44 +0000
19@@ -271,8 +271,7 @@
20 foreach (QUrl url, getEventUrls(event)) {
21 if (url.scheme() == "file" && url.path().endsWith(".desktop")) {
22 emit desktopFileDropped(url.path());
23- }
24- else if (url.scheme().startsWith("http")) {
25+ } else if (url.scheme().startsWith("http")) {
26 emit webpageUrlDropped(url);
27 }
28 }
29
30=== modified file 'libunity-2d-private/Unity2d/CMakeLists.txt'
31--- libunity-2d-private/Unity2d/CMakeLists.txt 2011-02-17 12:04:10 +0000
32+++ libunity-2d-private/Unity2d/CMakeLists.txt 2011-05-30 16:06:44 +0000
33@@ -15,6 +15,8 @@
34 cacheeffect.cpp
35 workspacesinfo.cpp
36 signalwaiter.cpp
37+ dragitem.cpp
38+ dragitemwithurl.cpp
39 dropitem.cpp
40 )
41
42@@ -27,6 +29,8 @@
43 cacheeffect.h
44 workspacesinfo.h
45 signalwaiter.h
46+ dragitem.h
47+ dragitemwithurl.h
48 dropitem.h
49 )
50
51
52=== added file 'libunity-2d-private/Unity2d/dragitem.cpp'
53--- libunity-2d-private/Unity2d/dragitem.cpp 1970-01-01 00:00:00 +0000
54+++ libunity-2d-private/Unity2d/dragitem.cpp 2011-05-30 16:06:44 +0000
55@@ -0,0 +1,159 @@
56+/*
57+ * Copyright (C) 2011 Canonical, Ltd.
58+ *
59+ * Authors:
60+ * Olivier Tilloy <olivier.tilloy@canonical.com>
61+ *
62+ * This program is free software; you can redistribute it and/or modify
63+ * it under the terms of the GNU General Public License as published by
64+ * the Free Software Foundation; version 3.
65+ *
66+ * This program is distributed in the hope that it will be useful,
67+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
68+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
69+ * GNU General Public License for more details.
70+ *
71+ * You should have received a copy of the GNU General Public License
72+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
73+ */
74+
75+#include "dragitem.h"
76+
77+#include <QDeclarativeEngine>
78+#include <QDeclarativeComponent>
79+#include <QGraphicsSceneMouseEvent>
80+#include <QApplication>
81+#include <QDrag>
82+#include <QGraphicsScene>
83+#include <QPainter>
84+#include <QMimeData>
85+#include <QX11Info>
86+
87+DeclarativeDragItem::DeclarativeDragItem(QDeclarativeItem* parent)
88+ : QDeclarativeItem(parent)
89+ , m_delegate(NULL)
90+ , m_supportedActions(Qt::LinkAction)
91+ , m_defaultAction(Qt::LinkAction)
92+{
93+ setAcceptedMouseButtons(Qt::LeftButton);
94+}
95+
96+DeclarativeDragItem::~DeclarativeDragItem()
97+{
98+}
99+
100+QDeclarativeComponent*
101+DeclarativeDragItem::delegate() const
102+{
103+ return m_delegate;
104+}
105+
106+void
107+DeclarativeDragItem::setDelegate(QDeclarativeComponent* delegate)
108+{
109+ if (delegate != m_delegate) {
110+ m_delegate = delegate;
111+ Q_EMIT delegateChanged();
112+ }
113+}
114+
115+void
116+DeclarativeDragItem::resetDelegate()
117+{
118+ setDelegate(NULL);
119+}
120+
121+Qt::DropActions
122+DeclarativeDragItem::supportedActions() const
123+{
124+ return m_supportedActions;
125+}
126+
127+void
128+DeclarativeDragItem::setSupportedActions(Qt::DropActions actions)
129+{
130+ if (actions != m_supportedActions) {
131+ m_supportedActions = actions;
132+ Q_EMIT supportedActionsChanged();
133+ }
134+}
135+
136+Qt::DropAction
137+DeclarativeDragItem::defaultAction() const
138+{
139+ return m_defaultAction;
140+}
141+
142+void
143+DeclarativeDragItem::setDefaultAction(Qt::DropAction action)
144+{
145+ if (action != m_defaultAction) {
146+ m_defaultAction = action;
147+ Q_EMIT defaultActionChanged();
148+ }
149+}
150+
151+QMimeData* DeclarativeDragItem::mimeData() const
152+{
153+ // Default implementation, empty mime data.
154+ return new QMimeData;
155+}
156+
157+void
158+DeclarativeDragItem::mouseMoveEvent(QGraphicsSceneMouseEvent* event)
159+{
160+ int distance = (event->buttonDownScreenPos(Qt::LeftButton) - event->screenPos()).manhattanLength();
161+ if (distance < QApplication::startDragDistance()) {
162+ return;
163+ }
164+
165+ QDrag* drag = new QDrag(event->widget());
166+ drag->setMimeData(mimeData());
167+
168+ if (m_delegate != NULL) {
169+ QObject* delegateObject = m_delegate->create(QDeclarativeEngine::contextForObject(this));
170+ QDeclarativeItem* delegate = qobject_cast<QDeclarativeItem*>(delegateObject);
171+ if (delegate != NULL) {
172+ /* Render the delegate to a pixmap. */
173+ QGraphicsScene scene;
174+ scene.addItem(delegate);
175+
176+ QPixmap pixmap(scene.sceneRect().width(), scene.sceneRect().height());
177+ bool compositing = QX11Info::isCompositingManagerRunning();
178+ if (!compositing) {
179+ pixmap.fill(Qt::transparent);
180+ }
181+ QPainter painter(&pixmap);
182+ if (compositing) {
183+ painter.setCompositionMode(QPainter::CompositionMode_Source);
184+ } else {
185+ /* Cheap solution to avoid aliasing: draw a solid white background. */
186+ painter.setPen(Qt::white);
187+ painter.setBrush(Qt::white);
188+ painter.drawRoundedRect(scene.sceneRect(), 5, 5);
189+ }
190+ scene.render(&painter);
191+ scene.removeItem(delegate);
192+ delete delegate;
193+
194+ drag->setPixmap(pixmap);
195+ drag->setHotSpot(QPoint(pixmap.width() / 2, pixmap.height() / 2));
196+ }
197+ }
198+
199+ Qt::DropAction action = drag->exec(m_supportedActions, m_defaultAction);
200+ Q_EMIT drop(action);
201+}
202+
203+void
204+DeclarativeDragItem::mousePressEvent(QGraphicsSceneMouseEvent* event)
205+{
206+ Q_EMIT pressed();
207+}
208+
209+void
210+DeclarativeDragItem::mouseReleaseEvent(QGraphicsSceneMouseEvent* event)
211+{
212+ Q_EMIT released();
213+}
214+
215
216=== added file 'libunity-2d-private/Unity2d/dragitem.h'
217--- libunity-2d-private/Unity2d/dragitem.h 1970-01-01 00:00:00 +0000
218+++ libunity-2d-private/Unity2d/dragitem.h 2011-05-30 16:06:44 +0000
219@@ -0,0 +1,77 @@
220+/*
221+ * Copyright (C) 2011 Canonical, Ltd.
222+ *
223+ * Authors:
224+ * Olivier Tilloy <olivier.tilloy@canonical.com>
225+ *
226+ * This program is free software; you can redistribute it and/or modify
227+ * it under the terms of the GNU General Public License as published by
228+ * the Free Software Foundation; version 3.
229+ *
230+ * This program is distributed in the hope that it will be useful,
231+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
232+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
233+ * GNU General Public License for more details.
234+ *
235+ * You should have received a copy of the GNU General Public License
236+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
237+ */
238+
239+#ifndef DeclarativeDragItem_H
240+#define DeclarativeDragItem_H
241+
242+#include <QDeclarativeItem>
243+
244+class QMimeData;
245+class QDeclarativeComponent;
246+
247+class DeclarativeDragItem : public QDeclarativeItem
248+{
249+ Q_OBJECT
250+
251+ Q_PROPERTY(QDeclarativeComponent* delegate READ delegate WRITE setDelegate NOTIFY delegateChanged RESET resetDelegate)
252+ Q_PROPERTY(Qt::DropActions supportedActions READ supportedActions WRITE setSupportedActions NOTIFY supportedActionsChanged)
253+ Q_PROPERTY(Qt::DropAction defaultAction READ defaultAction WRITE setDefaultAction NOTIFY defaultActionChanged)
254+
255+public:
256+ DeclarativeDragItem(QDeclarativeItem* parent=0);
257+ ~DeclarativeDragItem();
258+
259+ // getters and setters
260+ QDeclarativeComponent* delegate() const;
261+ void setDelegate(QDeclarativeComponent* delegate);
262+ void resetDelegate();
263+ Qt::DropActions supportedActions() const;
264+ void setSupportedActions(Qt::DropActions actions);
265+ Qt::DropAction defaultAction() const;
266+ void setDefaultAction(Qt::DropAction action);
267+
268+protected:
269+ // override in child classes to set a non-empty mime data
270+ virtual QMimeData* mimeData() const;
271+
272+Q_SIGNALS:
273+ void delegateChanged();
274+ void supportedActionsChanged();
275+ void defaultActionChanged();
276+ void drop(int action);
277+
278+ // Can’t pass around the mouse events as parameters
279+ // as QDeclarativeMouseEvent is a private class.
280+ void pressed();
281+ void released();
282+
283+protected:
284+ // reimplemented
285+ void mouseMoveEvent(QGraphicsSceneMouseEvent* event);
286+ void mousePressEvent(QGraphicsSceneMouseEvent* event);
287+ void mouseReleaseEvent(QGraphicsSceneMouseEvent* event);
288+
289+private:
290+ QDeclarativeComponent* m_delegate;
291+ Qt::DropActions m_supportedActions;
292+ Qt::DropAction m_defaultAction;
293+};
294+
295+#endif // DeclarativeDragItem_H
296+
297
298=== added file 'libunity-2d-private/Unity2d/dragitemwithurl.cpp'
299--- libunity-2d-private/Unity2d/dragitemwithurl.cpp 1970-01-01 00:00:00 +0000
300+++ libunity-2d-private/Unity2d/dragitemwithurl.cpp 2011-05-30 16:06:44 +0000
301@@ -0,0 +1,82 @@
302+/*
303+ * Copyright (C) 2011 Canonical, Ltd.
304+ *
305+ * Authors:
306+ * Olivier Tilloy <olivier.tilloy@canonical.com>
307+ *
308+ * This program is free software; you can redistribute it and/or modify
309+ * it under the terms of the GNU General Public License as published by
310+ * the Free Software Foundation; version 3.
311+ *
312+ * This program is distributed in the hope that it will be useful,
313+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
314+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
315+ * GNU General Public License for more details.
316+ *
317+ * You should have received a copy of the GNU General Public License
318+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
319+ */
320+
321+#include "dragitemwithurl.h"
322+
323+// libunity-2d
324+#include <gscopedpointer.h>
325+
326+// GIO
327+#undef signals
328+extern "C" {
329+ #include <gio/gdesktopappinfo.h>
330+}
331+
332+// Qt
333+#include <QMimeData>
334+
335+DeclarativeDragItemWithUrl::DeclarativeDragItemWithUrl(QDeclarativeItem* parent)
336+ : DeclarativeDragItem(parent)
337+{
338+}
339+
340+DeclarativeDragItemWithUrl::~DeclarativeDragItemWithUrl()
341+{
342+}
343+
344+const QString& DeclarativeDragItemWithUrl::url() const
345+{
346+ return m_url;
347+}
348+
349+void DeclarativeDragItemWithUrl::setUrl(const QString& url)
350+{
351+ if (url != m_url) {
352+ m_url = url;
353+ Q_EMIT urlChanged(m_url);
354+ }
355+}
356+
357+QMimeData* DeclarativeDragItemWithUrl::mimeData() const
358+{
359+ QMimeData* data = new QMimeData;
360+ if (!m_url.isEmpty()) {
361+ QList<QUrl> urls;
362+ urls.append(decodeUri(m_url));
363+ data->setUrls(urls);
364+ }
365+ return data;
366+}
367+
368+QUrl DeclarativeDragItemWithUrl::decodeUri(const QString& uri)
369+{
370+ if (uri.startsWith("application://")) {
371+ QString desktopFileName = uri.mid(14);
372+ QByteArray bytes = desktopFileName.toUtf8();
373+ GObjectScopedPointer<GDesktopAppInfo> appInfo(g_desktop_app_info_new(bytes.constData()));
374+ if (appInfo.isNull()) {
375+ return QUrl(uri);
376+ }
377+ QString filePath = QString::fromUtf8(g_desktop_app_info_get_filename(appInfo.data()));
378+ return QUrl("file://" + filePath);
379+ } else {
380+ return QUrl(uri);
381+ }
382+}
383+
384
385=== added file 'libunity-2d-private/Unity2d/dragitemwithurl.h'
386--- libunity-2d-private/Unity2d/dragitemwithurl.h 1970-01-01 00:00:00 +0000
387+++ libunity-2d-private/Unity2d/dragitemwithurl.h 2011-05-30 16:06:44 +0000
388@@ -0,0 +1,62 @@
389+/*
390+ * Copyright (C) 2011 Canonical, Ltd.
391+ *
392+ * Authors:
393+ * Olivier Tilloy <olivier.tilloy@canonical.com>
394+ *
395+ * This program is free software; you can redistribute it and/or modify
396+ * it under the terms of the GNU General Public License as published by
397+ * the Free Software Foundation; version 3.
398+ *
399+ * This program is distributed in the hope that it will be useful,
400+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
401+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
402+ * GNU General Public License for more details.
403+ *
404+ * You should have received a copy of the GNU General Public License
405+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
406+ */
407+
408+#ifndef DeclarativeDragItemWithUrl_H
409+#define DeclarativeDragItemWithUrl_H
410+
411+#include "dragitem.h"
412+
413+// Qt
414+#include <QString>
415+#include <QUrl>
416+
417+/* A specialized DragItem with a 'url' property that knows how to convert
418+ application:// URLs into the corresponding file:// URLs. */
419+class DeclarativeDragItemWithUrl : public DeclarativeDragItem
420+{
421+ Q_OBJECT
422+
423+ /* The URL cannot be a QUrl due to the malformed URIs returned by the place
424+ backends (see https://bugs.launchpad.net/unity-place-applications/+bug/784478). */
425+ Q_PROPERTY(QString url READ url WRITE setUrl NOTIFY urlChanged)
426+
427+public:
428+ DeclarativeDragItemWithUrl(QDeclarativeItem* parent=0);
429+ ~DeclarativeDragItemWithUrl();
430+
431+ // getters and setters
432+ const QString& url() const;
433+ void setUrl(const QString& url);
434+
435+protected:
436+ // overridden
437+ QMimeData* mimeData() const;
438+
439+private:
440+ static QUrl decodeUri(const QString& uri);
441+
442+Q_SIGNALS:
443+ void urlChanged(const QString&);
444+
445+private:
446+ QString m_url;
447+};
448+
449+#endif // DeclarativeDragItemWithUrl_H
450+
451
452=== modified file 'libunity-2d-private/Unity2d/plugin.cpp'
453--- libunity-2d-private/Unity2d/plugin.cpp 2011-04-28 13:09:25 +0000
454+++ libunity-2d-private/Unity2d/plugin.cpp 2011-05-30 16:06:44 +0000
455@@ -34,6 +34,7 @@
456
457 #include "mimedata.h"
458 #include "dragdropevent.h"
459+#include "dragitemwithurl.h"
460 #include "dropitem.h"
461
462 #include <QtDeclarative/qdeclarative.h>
463@@ -76,6 +77,7 @@
464 qmlRegisterType<QGraphicsDropShadowEffect>("Effects", 1, 0, "DropShadow");
465
466 /* Custom drag’n’drop implementation in QML */
467+ qmlRegisterType<DeclarativeDragItemWithUrl>(uri, 0, 1, "DragItemWithUrl");
468 qmlRegisterType<DeclarativeDropItem>(uri, 0, 1, "DropItem");
469 qmlRegisterType<DeclarativeMimeData>();
470 qmlRegisterType<DeclarativeDragDropEvent>();
471
472=== modified file 'places/AbstractButton.qml'
473--- places/AbstractButton.qml 2011-03-22 06:15:19 +0000
474+++ places/AbstractButton.qml 2011-05-30 16:06:44 +0000
475@@ -21,6 +21,13 @@
476 FocusScope {
477 property bool enabled: true
478
479+ /* Use to manually set the "pressed" state of the button. This is not
480+ necessary in the normal use case, but is useful when a child item eats
481+ the mouse events (e.g. a DragArea).
482+ This is a clumsy workaround for the lack of a MouseProxy element
483+ (see http://bugreports.qt.nokia.com/browse/QTBUG-13007). */
484+ property bool pressed: false
485+
486 signal clicked
487
488 MouseArea {
489@@ -45,7 +52,7 @@
490 }
491
492 state: {
493- if(mouse_area.pressed)
494+ if(pressed || mouse_area.pressed)
495 return "pressed"
496 else if(mouse_area.containsMouse)
497 return "selected"
498
499=== modified file 'places/UnityDefaultRenderer.qml'
500--- places/UnityDefaultRenderer.qml 2011-04-08 11:10:59 +0000
501+++ places/UnityDefaultRenderer.qml 2011-05-30 16:06:44 +0000
502@@ -17,6 +17,7 @@
503 */
504
505 import Qt 4.7
506+import Unity2d 1.0 /* required for drag’n’drop handling */
507
508 RendererGrid {
509 cellWidth: 136
510@@ -37,6 +38,34 @@
511 placeEntryModel.place.activate(decodeURIComponent(uri))
512 }
513
514+ DragItemWithUrl {
515+ anchors.fill: parent
516+ url: decodeURIComponent(uri)
517+ defaultAction: {
518+ if (!url.indexOf("application://")) return Qt.CopyAction
519+ else if (!url.indexOf("unity-install://")) return Qt.IgnoreAction
520+ else return Qt.LinkAction
521+ }
522+ supportedActions: defaultAction
523+ delegate: Component {
524+ Image {
525+ source: icon.source
526+ width: icon.width
527+ height: icon.height
528+ fillMode: icon.fillMode
529+ sourceSize.width: width
530+ sourceSize.height: height
531+ asynchronous: true
532+ }
533+ }
534+ onPressed: parent.pressed = true
535+ onReleased: {
536+ parent.pressed = false
537+ parent.clicked()
538+ }
539+ onDrop: parent.pressed = false
540+ }
541+
542 Image {
543 id: icon
544

Subscribers

People subscribed via source and target branches