aboutsummaryrefslogtreecommitdiffstats
path: root/src/quick/items/qquickmousearea.cpp
diff options
context:
space:
mode:
authorUlf Hermann <ulf.hermann@qt.io>2019-05-23 11:16:23 +0200
committerUlf Hermann <ulf.hermann@qt.io>2019-05-23 09:33:53 +0000
commit2f24150b03a8141b3e64442bcfcc08448b9a79e5 (patch)
treed742b17e50d24b82f7e5e58a04abf6c7a73cb4c2 /src/quick/items/qquickmousearea.cpp
parentc8c2db3f5b157131542025ce556d248c7a916a00 (diff)
Add a feature for Drag&Drop support in Qt Quick
Even if we have drag&drop in QtGui we don't necessarily want it in QtQuick. Also, since the QQuickDropArea needs QRegularExpression, quick-draganddrop needs to depend on regularexpression. Change-Id: I623e910178160ad3e3af3c01c96c30e88dc1b7ba Reviewed-by: Samuel Gaist <samuel.gaist@idiap.ch> Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
Diffstat (limited to 'src/quick/items/qquickmousearea.cpp')
-rw-r--r--src/quick/items/qquickmousearea.cpp22
1 files changed, 12 insertions, 10 deletions
diff --git a/src/quick/items/qquickmousearea.cpp b/src/quick/items/qquickmousearea.cpp
index 0b345697ec..53a5e5df1c 100644
--- a/src/quick/items/qquickmousearea.cpp
+++ b/src/quick/items/qquickmousearea.cpp
@@ -40,7 +40,9 @@
#include "qquickmousearea_p.h"
#include "qquickmousearea_p_p.h"
#include "qquickwindow.h"
+#if QT_CONFIG(quick_draganddrop)
#include "qquickdrag_p.h"
+#endif
#include <private/qqmldata_p.h>
#include <private/qsgadaptationlayer_p.h>
@@ -62,7 +64,7 @@ QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
moved(false), stealMouse(false), doubleClick(false), preventStealing(false),
propagateComposedEvents(false), overThreshold(false), pressed(nullptr),
pressAndHoldInterval(-1)
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
, drag(nullptr)
#endif
#if QT_CONFIG(cursor)
@@ -73,7 +75,7 @@ QQuickMouseAreaPrivate::QQuickMouseAreaPrivate()
QQuickMouseAreaPrivate::~QQuickMouseAreaPrivate()
{
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
delete drag;
#endif
#if QT_CONFIG(cursor)
@@ -685,7 +687,7 @@ void QQuickMouseArea::mousePressEvent(QMouseEvent *event)
} else {
d->longPress = false;
d->saveEvent(event);
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
if (d->drag)
d->drag->setActive(false);
#endif
@@ -712,7 +714,7 @@ void QQuickMouseArea::mouseMoveEvent(QMouseEvent *event)
// ### can GV handle this for us?
setHovered(contains(d->lastPos));
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
if (d->drag && d->drag->target()) {
if (!d->moved) {
d->targetStartPos = d->drag->target()->parentItem()
@@ -806,7 +808,7 @@ void QQuickMouseArea::mouseReleaseEvent(QMouseEvent *event)
setPressed(event->button(), false, event->source());
if (!d->pressed) {
// no other buttons are pressed
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
if (d->drag)
d->drag->setActive(false);
#endif
@@ -916,7 +918,7 @@ void QQuickMouseArea::ungrabMouse()
d->overThreshold = false;
setKeepMouseGrab(false);
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
if (d->drag)
d->drag->setActive(false);
#endif
@@ -999,7 +1001,7 @@ bool QQuickMouseArea::childMouseEventFilter(QQuickItem *i, QEvent *e)
Q_D(QQuickMouseArea);
if (!d->pressed &&
(!d->enabled || !isVisible()
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
|| !d->drag || !d->drag->filterChildren()
#endif
)
@@ -1022,7 +1024,7 @@ void QQuickMouseArea::timerEvent(QTimerEvent *event)
Q_D(QQuickMouseArea);
if (event->timerId() == d->pressAndHoldTimer.timerId()) {
d->pressAndHoldTimer.stop();
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
bool dragged = d->drag && d->drag->active();
#else
bool dragged = false;
@@ -1198,7 +1200,7 @@ bool QQuickMouseArea::setPressed(Qt::MouseButton button, bool p, Qt::MouseEventS
{
Q_D(QQuickMouseArea);
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
bool dragged = d->drag && d->drag->active();
#else
bool dragged = false;
@@ -1404,7 +1406,7 @@ void QQuickMouseArea::resetPressAndHoldInterval()
*/
-#if QT_CONFIG(draganddrop)
+#if QT_CONFIG(quick_draganddrop)
QQuickDrag *QQuickMouseArea::drag()
{
Q_D(QQuickMouseArea);