diff options
Diffstat (limited to 'src/quick/items/qquickflickable.cpp')
-rw-r--r-- | src/quick/items/qquickflickable.cpp | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/src/quick/items/qquickflickable.cpp b/src/quick/items/qquickflickable.cpp index 85045be411..cf882e8c9e 100644 --- a/src/quick/items/qquickflickable.cpp +++ b/src/quick/items/qquickflickable.cpp @@ -1,6 +1,6 @@ /**************************************************************************** ** -** Copyright (C) 2016 The Qt Company Ltd. +** Copyright (C) 2019 The Qt Company Ltd. ** Contact: https://www.qt.io/licensing/ ** ** This file is part of the QtQuick module of the Qt Toolkit. @@ -61,6 +61,8 @@ QT_BEGIN_NAMESPACE +Q_DECLARE_LOGGING_CATEGORY(lcHandlerParent) + // FlickThreshold determines how far the "mouse" must have moved // before we perform a flick. static const int FlickThreshold = 15; @@ -1897,6 +1899,8 @@ void QQuickFlickablePrivate::data_append(QQmlListProperty<QObject> *prop, QObjec { if (QQuickItem *i = qmlobject_cast<QQuickItem *>(o)) { i->setParentItem(static_cast<QQuickFlickablePrivate*>(prop->data)->contentItem); + } else if (QQuickPointerHandler *pointerHandler = qmlobject_cast<QQuickPointerHandler *>(o)) { + static_cast<QQuickFlickablePrivate*>(prop->data)->addPointerHandler(pointerHandler); } else { o->setParent(prop->object); // XXX todo - do we want this? } @@ -2356,6 +2360,14 @@ void QQuickFlickablePrivate::cancelInteraction() } } +void QQuickFlickablePrivate::addPointerHandler(QQuickPointerHandler *h) +{ + Q_Q(const QQuickFlickable); + qCDebug(lcHandlerParent) << "reparenting handler" << h << "to contentItem of" << q; + h->setParent(contentItem); + QQuickItemPrivate::get(contentItem)->addPointerHandler(h); +} + /*! QQuickFlickable::filterMouseEvent checks filtered mouse events and potentially steals them. |