Port DeclarativeDragDropEvent
This commit is contained in:
parent
53df27b8b7
commit
b60983ca1f
@ -1,5 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
Copyright (C) 2010 by BetterInbox <contact@betterinbox.com>
|
||||||
|
Copyright 2013 by Sebastian Kügler <sebas@kde.org>
|
||||||
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
Original author: Gregory Schlomoff <greg@betterinbox.com>
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
@ -23,24 +24,34 @@
|
|||||||
|
|
||||||
#include "DeclarativeDragDropEvent.h"
|
#include "DeclarativeDragDropEvent.h"
|
||||||
|
|
||||||
DeclarativeDragDropEvent::DeclarativeDragDropEvent(QEvent* e, DeclarativeDropArea* parent) :
|
DeclarativeDragDropEvent::DeclarativeDragDropEvent(QDropEvent* 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()),
|
||||||
// m_buttons(e->buttons()),
|
m_buttons(e->mouseButtons()),
|
||||||
// m_modifiers(e->modifiers()),
|
m_modifiers(e->keyboardModifiers()),
|
||||||
|
m_data(e->mimeData()),
|
||||||
|
m_event(e)
|
||||||
|
{
|
||||||
|
init();
|
||||||
|
}
|
||||||
|
|
||||||
|
DeclarativeDragDropEvent::DeclarativeDragDropEvent(QDragLeaveEvent* e, DeclarativeDropArea* parent) :
|
||||||
|
QObject(parent),
|
||||||
|
m_x(0),
|
||||||
|
m_y(0),
|
||||||
|
m_buttons(Qt::NoButton),
|
||||||
|
m_modifiers(Qt::NoModifier),
|
||||||
//m_data(e->mimeData()),
|
//m_data(e->mimeData()),
|
||||||
m_event(0)
|
m_event(0)
|
||||||
{
|
{
|
||||||
QPointF pos;
|
|
||||||
m_event = dynamic_cast<QDropEvent*>(e); // also covers enter
|
|
||||||
|
|
||||||
if (m_event) {
|
|
||||||
// m_x = m_event->pos.x();
|
|
||||||
// m_y = m_event->pos.y();
|
|
||||||
m_buttons = m_event->mouseButtons();
|
|
||||||
}
|
}
|
||||||
if (parent) {
|
|
||||||
|
void DeclarativeDragDropEvent::init()
|
||||||
|
{
|
||||||
|
QPointF pos;
|
||||||
|
|
||||||
|
if (parent()) {
|
||||||
//pos = parent->mapFromScene(e->scenePos());
|
//pos = parent->mapFromScene(e->scenePos());
|
||||||
m_x = pos.x();
|
m_x = pos.x();
|
||||||
m_y = pos.y();
|
m_y = pos.y();
|
||||||
|
@ -95,7 +95,8 @@ class DeclarativeDragDropEvent : public QObject
|
|||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
DeclarativeDragDropEvent(QEvent* e, DeclarativeDropArea* parent = 0);
|
DeclarativeDragDropEvent(QDropEvent* e, DeclarativeDropArea* parent = 0);
|
||||||
|
DeclarativeDragDropEvent(QDragLeaveEvent* 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; }
|
||||||
@ -109,6 +110,7 @@ public Q_SLOTS:
|
|||||||
void accept(int action);
|
void accept(int action);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
void init();
|
||||||
int m_x;
|
int m_x;
|
||||||
int m_y;
|
int m_y;
|
||||||
Qt::MouseButtons m_buttons;
|
Qt::MouseButtons m_buttons;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user