d->clearHover();
d->lastMousePosition = QPoint();
break;
+#ifndef QT_NO_DRAGANDDROP
case QEvent::DragEnter:
case QEvent::DragLeave:
case QEvent::DragMove:
case QEvent::Drop:
d->deliverDragEvent(&d->dragGrabber, e);
break;
+#endif
case QEvent::WindowDeactivate:
rootItem()->windowDeactivateEvent();
break;
return false;
}
+#ifndef QT_NO_DRAGANDDROP
void QQuickCanvasPrivate::deliverDragEvent(QQuickDragGrabber *grabber, QEvent *event)
{
Q_Q(QQuickCanvas);
return accepted;
}
+#endif // QT_NO_DRAGANDDROP
bool QQuickCanvasPrivate::sendFilteredMouseEvent(QQuickItem *target, QQuickItem *item, QEvent *event)
{
QQuickItemPrivate::get(item)->deliverTouchEvent(static_cast<QTouchEvent *>(e));
}
break;
+#ifndef QT_NO_DRAGANDDROP
case QEvent::DragEnter:
case QEvent::DragMove:
case QEvent::DragLeave:
case QEvent::Drop:
QQuickItemPrivate::get(item)->deliverDragEvent(e);
break;
+#endif
default:
break;
}
QQuickItem *activeFocusItem;
QQuickItem *mouseGrabberItem;
+#ifndef QT_NO_DRAGANDDROP
QQuickDragGrabber dragGrabber;
+#endif
int touchMouseId;
ulong touchMousePressTimestamp;
bool sendHoverEvent(QEvent::Type, QQuickItem *, const QPointF &scenePos, const QPointF &lastScenePos,
Qt::KeyboardModifiers modifiers, bool accepted);
bool clearHover();
+#ifndef QT_NO_DRAGANDDROP
void deliverDragEvent(QQuickDragGrabber *, QEvent *);
bool deliverDragEvent(QQuickDragGrabber *, QQuickItem *, QDragMoveEvent *);
+#endif
QList<QQuickItem*> hoverItems;
enum FocusOption {
#include <QtQml/qqmlinfo.h>
#include <QtGui/qevent.h>
+#ifndef QT_NO_DRAGANDDROP
+
QT_BEGIN_NAMESPACE
class QQuickDragAttachedPrivate : public QObjectPrivate, public QQuickItemChangeListener
}
QT_END_NAMESPACE
+
+#endif // QT_NO_DRAGANDDROP
#include <QtCore/qmimedata.h>
#include <QtCore/qstringlist.h>
+#ifndef QT_NO_DRAGANDDROP
QT_BEGIN_HEADER
QT_END_HEADER
+#endif // QT_NO_DRAGANDDROP
+
#endif
#include <private/qqmlengine_p.h>
+#ifndef QT_NO_DRAGANDDROP
+
QT_BEGIN_NAMESPACE
QQuickDropAreaDrag::QQuickDropAreaDrag(QQuickDropAreaPrivate *d, QObject *parent)
QT_END_NAMESPACE
+#endif // QT_NO_DRAGANDDROP
#include <QtGui/qevent.h>
+#ifndef QT_NO_DRAGANDDROP
+
QT_BEGIN_HEADER
QT_BEGIN_NAMESPACE
QT_END_HEADER
+#endif // QT_NO_DRAGANDDROP
+
#endif // QQUICKDROPAREA_P_H
Q_UNUSED(event);
}
+#ifndef QT_NO_DRAGANDDROP
void QQuickItem::dragEnterEvent(QDragEnterEvent *event)
{
Q_UNUSED(event);
{
Q_UNUSED(event);
}
+#endif // QT_NO_DRAGANDDROP
bool QQuickItem::childMouseEventFilter(QQuickItem *, QEvent *)
{
}
}
+#ifndef QT_NO_DRAGANDDROP
void QQuickItemPrivate::deliverDragEvent(QEvent *e)
{
Q_Q(QQuickItem);
break;
}
}
+#endif // QT_NO_DRAGANDDROP
void QQuickItem::itemChange(ItemChange change, const ItemChangeData &value)
{
virtual void hoverEnterEvent(QHoverEvent *event);
virtual void hoverMoveEvent(QHoverEvent *event);
virtual void hoverLeaveEvent(QHoverEvent *event);
+#ifndef QT_NO_DRAGANDDROP
virtual void dragEnterEvent(QDragEnterEvent *);
virtual void dragMoveEvent(QDragMoveEvent *);
virtual void dragLeaveEvent(QDragLeaveEvent *);
virtual void dropEvent(QDropEvent *);
+#endif
virtual bool childMouseEventFilter(QQuickItem *, QEvent *);
virtual void windowDeactivateEvent();
void deliverWheelEvent(QWheelEvent *);
void deliverTouchEvent(QTouchEvent *);
void deliverHoverEvent(QHoverEvent *);
+#ifndef QT_NO_DRAGANDDROP
void deliverDragEvent(QEvent *);
+#endif
bool calcEffectiveVisible() const;
bool setEffectiveVisibleRecur(bool);
qmlRegisterType<QQuickPathAnimation>("QtQuick",2,0,"PathAnimation");
qmlRegisterType<QQuickPathInterpolator>("QtQuick",2,0,"PathInterpolator");
+#ifndef QT_NO_DRAGANDDROP
qmlRegisterType<QQuickDropArea>("QtQuick", 2, 0, "DropArea");
qmlRegisterType<QQuickDropEvent>();
qmlRegisterType<QQuickDropAreaDrag>();
qmlRegisterUncreatableType<QQuickDrag>("QtQuick", 2, 0, "Drag", QQuickDragAttached::tr("Drag is only available via attached properties"));
+#endif
qmlRegisterType<QQuickMultiPointTouchArea>("QtQuick", 2, 0, "MultiPointTouchArea");
qmlRegisterType<QQuickTouchPoint>("QtQuick", 2, 0, "TouchPoint");
static const int PressAndHoldDelay = 800;
+#ifndef QT_NO_DRAGANDDROP
+
QQuickDrag::QQuickDrag(QObject *parent)
: QObject(parent), _target(0), _axis(XandYAxis), _xmin(-FLT_MAX),
_xmax(FLT_MAX), _ymin(-FLT_MAX), _ymax(FLT_MAX), _active(false), _filterChildren(false)
return new QQuickDragAttached(obj);
}
+#endif // QT_NO_DRAGANDDROP
+
QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
: enabled(true), hovered(false), pressed(false), longPress(false),
moved(false), dragX(true), dragY(true), stealMouse(false), doubleClick(false), preventStealing(false),
- propagateComposedEvents(false), drag(0)
+ propagateComposedEvents(false)
+#ifndef QT_NO_DRAGANDDROP
+ , drag(0)
+#endif
{
}
QQuickMouseAreaPrivate::~QQuickMouseAreaPrivate()
{
+#ifndef QT_NO_DRAGANDDROP
delete drag;
+#endif
}
void QQuickMouseAreaPrivate::init()
else {
d->longPress = false;
d->saveEvent(event);
+#ifndef QT_NO_DRAGANDDROP
if (d->drag)
d->drag->setActive(false);
+#endif
setHovered(true);
d->startScene = event->windowPos();
d->pressAndHoldTimer.start(PressAndHoldDelay, this);
setKeepMouseGrab(d->stealMouse);
event->setAccepted(setPressed(true));
+#ifndef QT_NO_DRAGANDDROP
if (d->drag) {
d->dragX = drag()->axis() & QQuickDrag::XAxis;
d->dragY = drag()->axis() & QQuickDrag::YAxis;
}
+#endif
}
}
else if (!d->hovered && isInside)
setHovered(true);
+#ifndef QT_NO_DRAGANDDROP
if (d->drag && d->drag->target()) {
if (!d->moved) {
d->targetStartPos = d->drag->target()->parentItem()
d->moved = true;
}
+#endif
+
QQuickMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
emit mouseXChanged(&me);
me.setPosition(d->lastPos);
} else {
d->saveEvent(event);
setPressed(false);
+#ifndef QT_NO_DRAGANDDROP
if (d->drag)
d->drag->setActive(false);
+#endif
// If we don't accept hover, we need to reset containsMouse.
if (!acceptHoverEvents())
setHovered(false);
bool QQuickMouseArea::childMouseEventFilter(QQuickItem *i, QEvent *e)
{
Q_D(QQuickMouseArea);
- if (!d->pressed && (!d->enabled || !isVisible() || !d->drag || !d->drag->filterChildren()))
+ if (!d->pressed &&
+ (!d->enabled || !isVisible()
+#ifndef QT_NO_DRAGANDDROP
+ || !d->drag || !d->drag->filterChildren()
+#endif
+ )
+ )
return QQuickItem::childMouseEventFilter(i, e);
switch (e->type()) {
case QEvent::MouseButtonPress:
Q_D(QQuickMouseArea);
if (event->timerId() == d->pressAndHoldTimer.timerId()) {
d->pressAndHoldTimer.stop();
+#ifndef QT_NO_DRAGANDDROP
bool dragged = d->drag && d->drag->active();
+#else
+ bool dragged = false;
+#endif
if (d->pressed && dragged == false && d->hovered == true) {
d->longPress = true;
QQuickMouseEvent me(d->lastPos.x(), d->lastPos.y(), d->lastButton, d->lastButtons, d->lastModifiers, false, d->longPress);
bool QQuickMouseArea::setPressed(bool p)
{
Q_D(QQuickMouseArea);
+#ifndef QT_NO_DRAGANDDROP
bool dragged = d->drag && d->drag->active();
+#else
+ bool dragged = false;
+#endif
bool isclick = d->pressed == true && p == false && dragged == false && d->hovered == true;
if (d->pressed != p) {
*/
+#ifndef QT_NO_DRAGANDDROP
QQuickDrag *QQuickMouseArea::drag()
{
Q_D(QQuickMouseArea);
d->drag = new QQuickDrag;
return d->drag;
}
+#endif
QSGNode *QQuickMouseArea::updatePaintNode(QSGNode *oldNode, UpdatePaintNodeData *data)
{
QT_BEGIN_NAMESPACE
-class QQuickDragAttached;
class QQuickMouseEvent;
+
+#ifndef QT_NO_DRAGANDDROP
+
+class QQuickDragAttached;
class Q_AUTOTEST_EXPORT QQuickDrag : public QObject
{
Q_OBJECT
Q_DISABLE_COPY(QQuickDrag)
};
+#endif // QT_NO_DRAGANDDROP
+
class QQuickMouseAreaPrivate;
class QQuickWheelEvent;
// used in QtLocation
Q_PROPERTY(Qt::MouseButtons pressedButtons READ pressedButtons NOTIFY pressedChanged)
Q_PROPERTY(Qt::MouseButtons acceptedButtons READ acceptedButtons WRITE setAcceptedButtons NOTIFY acceptedButtonsChanged)
Q_PROPERTY(bool hoverEnabled READ hoverEnabled WRITE setHoverEnabled NOTIFY hoverEnabledChanged)
+#ifndef QT_NO_DRAGANDDROP
Q_PROPERTY(QQuickDrag *drag READ drag CONSTANT) //### add flicking to QQuickDrag or add a QQuickFlick ???
+#endif
Q_PROPERTY(bool preventStealing READ preventStealing WRITE setPreventStealing NOTIFY preventStealingChanged)
Q_PROPERTY(bool propagateComposedEvents READ propagateComposedEvents WRITE setPropagateComposedEvents NOTIFY propagateComposedEventsChanged)
bool hoverEnabled() const;
void setHoverEnabled(bool h);
+#ifndef QT_NO_DRAGANDDROP
QQuickDrag *drag();
+#endif
bool preventStealing() const;
void setPreventStealing(bool prevent);
QT_END_NAMESPACE
+#ifndef QT_NO_DRAGANDDROP
QML_DECLARE_TYPE(QQuickDrag)
QML_DECLARE_TYPEINFO(QQuickDrag, QML_HAS_ATTACHED_PROPERTIES)
+#endif
QML_DECLARE_TYPE(QQuickMouseArea)
QT_END_HEADER
bool doubleClick : 1;
bool preventStealing : 1;
bool propagateComposedEvents : 1;
+#ifndef QT_NO_DRAGANDDROP
QQuickDrag *drag;
+#endif
QPointF startScene;
QPointF targetStartPos;
QPointF lastPos;