Default QQuickItem::acceptTouchEvents to true until Qt 6
This is a partial revert of 1457df74f4
to avoid making a mandatory API change so soon.
Change-Id: I05040579fa36d3dc5ef7616861f6d17adf500d2c
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
parent
d84af8b815
commit
ab91e7fa02
|
@ -270,6 +270,7 @@ void QQuickFlickablePrivate::init()
|
|||
qmlobject_connect(&velocityTimeline, QQuickTimeLine, SIGNAL(completed()),
|
||||
q, QQuickFlickable, SLOT(velocityTimelineCompleted()))
|
||||
q->setAcceptedMouseButtons(Qt::LeftButton);
|
||||
q->setAcceptTouchEvents(false); // rely on mouse events synthesized from touch
|
||||
q->setFiltersChildMouseEvents(true);
|
||||
QQuickItemPrivate *viewportPrivate = QQuickItemPrivate::get(contentItem);
|
||||
viewportPrivate->addItemChangeListener(this, QQuickItemPrivate::Geometry);
|
||||
|
|
|
@ -3171,7 +3171,11 @@ QQuickItemPrivate::QQuickItemPrivate()
|
|||
, antialiasingValid(false)
|
||||
, isTabFence(false)
|
||||
, replayingPressEvent(false)
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
, touchEnabled(true)
|
||||
#else
|
||||
, touchEnabled(false)
|
||||
#endif
|
||||
, dirtyAttributes(0)
|
||||
, nextDirtyItem(0)
|
||||
, prevDirtyItem(0)
|
||||
|
|
|
@ -85,6 +85,7 @@ void QQuickMouseAreaPrivate::init()
|
|||
{
|
||||
Q_Q(QQuickMouseArea);
|
||||
q->setAcceptedMouseButtons(Qt::LeftButton);
|
||||
q->setAcceptTouchEvents(false); // rely on mouse events synthesized from touch
|
||||
q->setFiltersChildMouseEvents(true);
|
||||
if (qmlVisualTouchDebugging()) {
|
||||
q->setFlag(QQuickItem::ItemHasContents);
|
||||
|
|
|
@ -324,6 +324,9 @@ QQuickRectangle::QQuickRectangle(QQuickItem *parent)
|
|||
: QQuickItem(*(new QQuickRectanglePrivate), parent)
|
||||
{
|
||||
setFlag(ItemHasContents);
|
||||
#if QT_VERSION < QT_VERSION_CHECK(6, 0, 0)
|
||||
setAcceptTouchEvents(false);
|
||||
#endif
|
||||
}
|
||||
|
||||
/*!
|
||||
|
|
|
@ -2668,9 +2668,15 @@ void QQuickWindowPrivate::updateFilteringParentItems(const QVector<QQuickItem *>
|
|||
}
|
||||
filteringParentItems.clear();
|
||||
for (QQuickItem *item : targetItems) {
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
bool acceptsTouchEvents = item->acceptTouchEvents();
|
||||
#else
|
||||
// In versions prior to Qt 6, we can't trust item->acceptTouchEvents() here, because it defaults to true.
|
||||
bool acceptsTouchEvents = false;
|
||||
#endif
|
||||
QQuickItemPrivate *itemPriv = QQuickItemPrivate::get(item);
|
||||
// If the item neither handles events nor has handlers which do, then it will never be a receiver, so filtering is irrelevant
|
||||
if (!item->acceptedMouseButtons() && !item->acceptTouchEvents() &&
|
||||
// If the item neither handles events nor has handlers which do, then it will never be a receiver, so filtering is irrelevant.
|
||||
if (!item->acceptedMouseButtons() && !acceptsTouchEvents &&
|
||||
!(itemPriv->extra.isAllocated() && !itemPriv->extra->pointerHandlers.isEmpty()))
|
||||
continue;
|
||||
QQuickItem *parent = item->parentItem();
|
||||
|
|
|
@ -64,7 +64,11 @@ public:
|
|||
, ungrabs(0)
|
||||
, m_active(false)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
setAcceptTouchEvents(true);
|
||||
#else
|
||||
setAcceptedMouseButtons(Qt::LeftButton); // not really, but we want touch events
|
||||
#endif
|
||||
}
|
||||
|
||||
QPointF pos() const { return m_pos; }
|
||||
|
|
|
@ -49,8 +49,11 @@ public:
|
|||
: QQuickItem(parent), focused(false), pressCount(0), releaseCount(0)
|
||||
, wheelCount(0), acceptIncomingTouchEvents(true)
|
||||
, touchEventReached(false), timestamp(0)
|
||||
, lastWheelEventPos(0, 0), lastWheelEventGlobalPos(0, 0) {
|
||||
, lastWheelEventPos(0, 0), lastWheelEventGlobalPos(0, 0)
|
||||
{
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
setAcceptTouchEvents(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
bool focused;
|
||||
|
|
|
@ -74,7 +74,9 @@ public:
|
|||
: QQuickItem(parent), touchUngrabCount(0), acceptMouse(false), acceptTouch(false), filterTouch(false), point0(-1)
|
||||
{
|
||||
setAcceptedMouseButtons(Qt::LeftButton);
|
||||
#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
|
||||
setAcceptTouchEvents(true);
|
||||
#endif
|
||||
}
|
||||
|
||||
void touchEvent(QTouchEvent *event)
|
||||
|
|
Loading…
Reference in New Issue