gestures: fix build when -DFEATURE_scrollarea=OFF

Pick-to: 6.7 6.5
Change-Id: I1c6089875024b2cb4e3787bf7dcc2f7e8e441bd2
Reviewed-by: Volker Hilsheimer <volker.hilsheimer@qt.io>
(cherry picked from commit 91bfa5531a92001f48863888e40a870aaba94602)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Vladimir Belyavsky 2024-08-02 01:35:05 +03:00 committed by Qt Cherry-pick Bot
parent 633751f186
commit 36e5c45071

View File

@ -6,7 +6,9 @@
#include "qgesture_p.h"
#include "qevent.h"
#include "qwidget.h"
#if QT_CONFIG(scrollarea)
#include "qabstractscrollarea.h"
#endif
#if QT_CONFIG(graphicsview)
#include <qgraphicssceneevent.h>
#endif
@ -24,7 +26,7 @@ static const qreal kSingleStepScaleMin = 0.1;
QGesture *QPanGestureRecognizer::create(QObject *target)
{
if (target && target->isWidgetType()) {
#if (defined(Q_OS_MACOS) || defined(Q_OS_WIN)) && !defined(QT_NO_NATIVE_GESTURES)
#if (defined(Q_OS_MACOS) || defined(Q_OS_WIN)) && !defined(QT_NO_NATIVE_GESTURES) && QT_CONFIG(scrollarea)
// for scroll areas on Windows and OS X we want to use native gestures instead
if (!qobject_cast<QAbstractScrollArea *>(target->parent()))
static_cast<QWidget *>(target)->setAttribute(Qt::WA_AcceptTouchEvents);