diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:26:22 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2013-06-24 11:48:46 +0200 |
commit | 1a9759855639b9e2b3cdc0687d3381dcbf6c9815 (patch) | |
tree | b2da51f6eddddb83c2d97cdcfac24d38d2e67a4e /src/quick/items/qquickpincharea.cpp | |
parent | 8217ec1b888f3ff93f004801b018c5f85362c484 (diff) | |
parent | e1fc2793aef53b84a3f1e19b6d6bdf1141340074 (diff) |
Merge branch 'dev' of ssh://codereview.qt-project.org/qt/qtdeclarative into wip/v4
Conflicts:
src/imports/qtquick2/plugins.qmltypes
src/qml/debugger/qv8debugservice.cpp
src/qml/qml/qml.pri
src/qml/qml/qqmlcompiler.cpp
src/qml/qml/qqmlcomponent.cpp
src/qml/qml/qqmlcontext.cpp
src/qml/qml/qqmldata_p.h
src/qml/qml/qqmlengine_p.h
src/qml/qml/qqmljavascriptexpression.cpp
src/qml/qml/qqmlxmlhttprequest.cpp
src/qml/qml/v4/qv4bindings.cpp
src/qml/qml/v4/qv4irbuilder.cpp
src/qml/qml/v4/qv4jsonobject_p.h
src/qml/qml/v8/qqmlbuiltinfunctions.cpp
src/qml/qml/v8/qv8bindings.cpp
src/qml/qml/v8/qv8contextwrapper.cpp
src/qml/qml/v8/qv8listwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper.cpp
src/qml/qml/v8/qv8qobjectwrapper_p.h
src/qml/qml/v8/qv8sequencewrapper_p_p.h
src/qml/qml/v8/qv8typewrapper.cpp
src/qml/qml/v8/qv8valuetypewrapper.cpp
src/qml/types/qqmldelegatemodel.cpp
src/quick/items/context2d/qquickcanvasitem.cpp
src/quick/items/context2d/qquickcontext2d.cpp
sync.profile
tests/auto/qml/qjsengine/tst_qjsengine.cpp
tests/benchmarks/qml/animation/animation.pro
tools/qmlprofiler/qmlprofiler.pro
Change-Id: I18a76b8a81d87523247fa03a44ca334b1a2360c9
Diffstat (limited to 'src/quick/items/qquickpincharea.cpp')
-rw-r--r-- | src/quick/items/qquickpincharea.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/src/quick/items/qquickpincharea.cpp b/src/quick/items/qquickpincharea.cpp index 0e47b61319..434eaa8723 100644 --- a/src/quick/items/qquickpincharea.cpp +++ b/src/quick/items/qquickpincharea.cpp @@ -45,6 +45,7 @@ #include <QtGui/qevent.h> #include <QtGui/qguiapplication.h> #include <QtGui/qstylehints.h> +#include <qpa/qplatformnativeinterface.h> #include <float.h> #include <math.h> @@ -246,11 +247,15 @@ QQuickPinchAreaPrivate::~QQuickPinchAreaPrivate() QQuickPinchArea::QQuickPinchArea(QQuickItem *parent) : QQuickItem(*(new QQuickPinchAreaPrivate), parent) + , _currentWindow(0) { Q_D(QQuickPinchArea); d->init(); setAcceptedMouseButtons(Qt::LeftButton); setFiltersChildMouseEvents(true); +#ifdef Q_OS_MAC + connect(this, &QQuickItem::windowChanged, this, &QQuickPinchArea::setTouchEventsEnabledForWindow); +#endif } QQuickPinchArea::~QQuickPinchArea() @@ -539,6 +544,29 @@ QQuickPinch *QQuickPinchArea::pinch() return d->pinch; } +void QQuickPinchArea::setTouchEventsEnabledForWindow(QWindow *window) +{ +#ifdef Q_OS_MAC + // Resolve function for enabling touch events from the (cocoa) platform plugin. + typedef void (*RegisterTouchWindowFunction)(QWindow *, bool); + RegisterTouchWindowFunction registerTouchWindow = reinterpret_cast<RegisterTouchWindowFunction>( + QGuiApplication::platformNativeInterface()->nativeResourceFunctionForIntegration("registertouchwindow")); + if (!registerTouchWindow) + return; // Not necessarily an error, Qt migh be using a different platform plugin. + + // Disable touch on the old window, enable on the new window. + if (_currentWindow) + registerTouchWindow(_currentWindow, false); + if (window) + registerTouchWindow(window, true); + // Save the current window, setTouchEventsEnabledForWindow will be called + // with a null window on disable. + _currentWindow = window; +#else // Q_OS_MAC + Q_UNUSED(window) +#endif +} + QT_END_NAMESPACE |