add a bit of debugging info

which shows that we're getting wrong events right now. :/
This commit is contained in:
Sebastian Kügler 2013-02-27 22:12:10 +01:00
parent 3be712eacd
commit 8a386d065c
3 changed files with 14 additions and 0 deletions

View File

@ -31,6 +31,8 @@
#include <QApplication>
#include <QQmlContext>
#include <QDebug>
/*!
A DragArea is used to make an item draggable.
*/
@ -249,6 +251,7 @@ bool DeclarativeDragArea::childMouseEventFilter(QQuickItem *item, QEvent *event)
if (event->type() == QEvent::MouseMove) {
QMouseEvent *me = static_cast<QMouseEvent *>(event);
qDebug() << "move in dragarea";
mouseMoveEvent(me);
}

View File

@ -27,33 +27,42 @@
#include <QGraphicsSceneDragDropEvent>
#include <QMimeData>
#include <QDebug>
DeclarativeDropArea::DeclarativeDropArea(QQuickItem *parent)
: QQuickItem(parent),
m_enabled(true)
{
setFlag(ItemAcceptsDrops, m_enabled);
setFlag(ItemHasContents, m_enabled);
setAcceptHoverEvents(m_enabled);
}
void DeclarativeDropArea::dragEnterEvent(QDragEnterEvent *event) {
DeclarativeDragDropEvent dde(event, this);
qDebug() << "enter.";
emit dragEnter(&dde);
}
void DeclarativeDropArea::dragLeaveEvent(QDragLeaveEvent *event)
{
DeclarativeDragDropEvent dde(event, this);
qDebug() << "leave.";
emit dragLeave(&dde);
}
void DeclarativeDropArea::dragMoveEvent(QDragMoveEvent *event)
{
DeclarativeDragDropEvent dde(event, this);
qDebug() << "move.";
emit dragMove(&dde);
}
void DeclarativeDropArea::dropEvent(QDropEvent *event)
{
DeclarativeDragDropEvent dde(event, this);
qDebug() << "Drop.";
emit drop(&dde);
}
@ -69,6 +78,7 @@ void DeclarativeDropArea::setEnabled(bool enabled)
}
m_enabled = enabled;
setAcceptHoverEvents(m_enabled);
setFlag(ItemAcceptsDrops, m_enabled);
emit enabledChanged();
}

View File

@ -31,6 +31,7 @@
void DragAndDropPlugin::registerTypes(const char *uri)
{
qDebug() << " ********** " << uri << "loaded.";
Q_ASSERT(uri == QLatin1String("org.kde.draganddrop"));
qmlRegisterType<DeclarativeDropArea>(uri, 1, 0, "DropArea");