diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2014-01-24 16:37:45 +0100 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2014-01-24 18:27:41 +0100 |
commit | 22041acdfe85c9a9b814e11cd86e8ee5a55be82d (patch) | |
tree | 1b4d1bfa0ebba9e5d1495b5ca7055dba94642c46 /src/quick/items/qquickmultipointtoucharea.cpp | |
parent | 6ae57f01bb1495a74b23a81c590672ce788d5400 (diff) | |
parent | 2407cd29e628671f7f5144e0d241d4249a3ab612 (diff) |
Merge remote-tracking branch 'origin/stable' into dev
Conflicts:
src/imports/dialogs/qquickmessagedialog.cpp
src/imports/dialogs/qquickmessagedialog_p.h
src/qml/debugger/qqmlprofilerservice_p.h
src/qml/jsruntime/qv4regexpobject.cpp
tests/auto/qml/debugger/qqmlprofilerservice/qqmlprofilerservice.pro
Change-Id: Ic8a43366b44d6970966acbf03b206d0dee00c28d
Diffstat (limited to 'src/quick/items/qquickmultipointtoucharea.cpp')
-rw-r--r-- | src/quick/items/qquickmultipointtoucharea.cpp | 38 |
1 files changed, 20 insertions, 18 deletions
diff --git a/src/quick/items/qquickmultipointtoucharea.cpp b/src/quick/items/qquickmultipointtoucharea.cpp index 6b273dcd43..973f6efdcc 100644 --- a/src/quick/items/qquickmultipointtoucharea.cpp +++ b/src/quick/items/qquickmultipointtoucharea.cpp @@ -324,7 +324,6 @@ void QQuickTouchPoint::setSceneY(qreal sceneY) QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent) : QQuickItem(parent), - _currentWindow(0), _minimumTouchPoints(0), _maximumTouchPoints(INT_MAX), _stealMouse(false) @@ -334,8 +333,8 @@ QQuickMultiPointTouchArea::QQuickMultiPointTouchArea(QQuickItem *parent) if (qmlVisualTouchDebugging()) { setFlag(QQuickItem::ItemHasContents); } -#ifdef Q_OS_MAC - connect(this, &QQuickItem::windowChanged, this, &QQuickMultiPointTouchArea::setTouchEventsEnabledForWindow); +#ifdef Q_OS_OSX + setAcceptHoverEvents(true); // needed to enable touch events on mouse hover. #endif } @@ -548,28 +547,31 @@ void QQuickMultiPointTouchArea::addTouchPoint(const QTouchEvent::TouchPoint *p) _pressedTouchPoints.append(dtp); } -void QQuickMultiPointTouchArea::setTouchEventsEnabledForWindow(QWindow *window) +#ifdef Q_OS_OSX +void QQuickMultiPointTouchArea::hoverEnterEvent(QHoverEvent *event) +{ + Q_UNUSED(event); + setTouchEventsEnabled(true); +} + +void QQuickMultiPointTouchArea::hoverLeaveEvent(QHoverEvent *event) +{ + Q_UNUSED(event); + setTouchEventsEnabled(false); +} + +void QQuickMultiPointTouchArea::setTouchEventsEnabled(bool enable) { -#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 + return; // Not necessarily an error, Qt might be using a different platform plugin. + + registerTouchWindow(window(), enable); } +#endif // Q_OS_OSX void QQuickMultiPointTouchArea::addTouchPrototype(QQuickTouchPoint *prototype) { |