use a position relative to the DropArea
view-position is completely useless from QML
This commit is contained in:
parent
f8e9eeb587
commit
3910b0604f
@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
#include "DeclarativeDragDropEvent.h"
|
#include "DeclarativeDragDropEvent.h"
|
||||||
|
|
||||||
DeclarativeDragDropEvent::DeclarativeDragDropEvent(QGraphicsSceneDragDropEvent* e, QObject* parent) :
|
DeclarativeDragDropEvent::DeclarativeDragDropEvent(QGraphicsSceneDragDropEvent* e, DeclarativeDropArea* parent) :
|
||||||
QObject(parent),
|
QObject(parent),
|
||||||
m_x(e->pos().x()),
|
m_x(e->pos().x()),
|
||||||
m_y(e->pos().y()),
|
m_y(e->pos().y()),
|
||||||
@ -32,7 +32,11 @@ DeclarativeDragDropEvent::DeclarativeDragDropEvent(QGraphicsSceneDragDropEvent*
|
|||||||
m_data(e->mimeData()),
|
m_data(e->mimeData()),
|
||||||
m_event(e)
|
m_event(e)
|
||||||
{
|
{
|
||||||
|
if (parent) {
|
||||||
|
QPointF pos = parent->mapFromScene(e->scenePos());
|
||||||
|
m_x = pos.x();
|
||||||
|
m_y = pos.y();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DeclarativeDragDropEvent::accept(int action)
|
void DeclarativeDragDropEvent::accept(int action)
|
||||||
|
@ -27,18 +27,19 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QGraphicsSceneDragDropEvent>
|
#include <QGraphicsSceneDragDropEvent>
|
||||||
#include "DeclarativeMimeData.h"
|
#include "DeclarativeMimeData.h"
|
||||||
|
#include "DeclarativeDropArea.h"
|
||||||
|
|
||||||
class DeclarativeDragDropEvent : public QObject
|
class DeclarativeDragDropEvent : public QObject
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mouse X position of the event relative to the view that sent the event.
|
* The mouse X position of the event relative to the DropArea that is receiving the event.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(int x READ x)
|
Q_PROPERTY(int x READ x)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The mouse Y position of the event relative to the view that sent the event.
|
* The mouse Y position of the event relative to the DropArea that is receiving the event.
|
||||||
*/
|
*/
|
||||||
Q_PROPERTY(int y READ y)
|
Q_PROPERTY(int y READ y)
|
||||||
|
|
||||||
@ -94,7 +95,7 @@ class DeclarativeDragDropEvent : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DeclarativeDragDropEvent(QGraphicsSceneDragDropEvent* e, QObject* parent = 0);
|
DeclarativeDragDropEvent(QGraphicsSceneDragDropEvent* e, DeclarativeDropArea* parent = 0);
|
||||||
|
|
||||||
int x() const { return m_x; }
|
int x() const { return m_x; }
|
||||||
int y() const { return m_y; }
|
int y() const { return m_y; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user