Make it possible for ContainmentInterface to deal with WrappedMimeData

This way it integrates properly with KDeclarative as well. This will need
to be extended in order to integrate QtQuick.DropArea.
This commit is contained in:
Aleix Pol 2015-02-20 21:27:09 +01:00
parent e2e7cb1cab
commit b14463f352
2 changed files with 14 additions and 0 deletions

View File

@ -311,6 +311,15 @@ QPointF ContainmentInterface::mapToApplet(AppletInterface *applet, int x, int y)
return pos - applet->mapToScene(QPointF(0, 0)); return pos - applet->mapToScene(QPointF(0, 0));
} }
void ContainmentInterface::processMimeData(QObject *mimeDataProxy, int x, int y)
{
QMimeData* mime = qobject_cast<QMimeData*>(mimeDataProxy);
if (mime)
processMimeData(mime, x, y);
else
processMimeData(mimeDataProxy->property("mimeData").value<QMimeData*>(), x, y);
}
void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y) void ContainmentInterface::processMimeData(QMimeData *mimeData, int x, int y)
{ {
if (!mimeData) { if (!mimeData) {

View File

@ -122,6 +122,11 @@ public:
*/ */
Q_INVOKABLE void processMimeData(QMimeData *data, int x, int y); Q_INVOKABLE void processMimeData(QMimeData *data, int x, int y);
/**
* Process the mime data arrived to a particular coordinate, either with a drag and drop or paste with middle mouse button
*/
Q_INVOKABLE void processMimeData(QObject *data, int x, int y);
/** /**
* Search for a containment at those coordinates. * Search for a containment at those coordinates.
* the coordinates are passed as local coordinates of *this* containment * the coordinates are passed as local coordinates of *this* containment