From d468bd990787a50899438202b86389462b825993 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tomi=20Korpip=C3=A4=C3=A4?= Date: Tue, 21 Jan 2014 13:56:29 +0200 Subject: InputState enum moved to private Task-number: QTRD-2784 Change-Id: Ibda5445cc9872e2a5bf234914f11d4c380447cf4 Change-Id: Ibda5445cc9872e2a5bf234914f11d4c380447cf4 Reviewed-by: Miikka Heikkinen --- .../input/qtouch3dinputhandler.cpp | 54 ++++++++++++---------- 1 file changed, 30 insertions(+), 24 deletions(-) (limited to 'src/datavisualization/input/qtouch3dinputhandler.cpp') diff --git a/src/datavisualization/input/qtouch3dinputhandler.cpp b/src/datavisualization/input/qtouch3dinputhandler.cpp index 3fc5bea4..d0b57aee 100644 --- a/src/datavisualization/input/qtouch3dinputhandler.cpp +++ b/src/datavisualization/input/qtouch3dinputhandler.cpp @@ -45,22 +45,27 @@ const int maxZoomLevel = 500; * * Default touch input handler has the following functionalty: * \table - * \header - * \li Gesture \li Action - * \row - * \li Touch-And-Move \li Rotate graph within limits set for Q3DCamera - * \row - * \li Tap \li Select the item tapped or remove selection if none. - * May open the secondary view depending on the - * selection mode. - * \row - * \li Tap-And-Hold \li Same as tap. - * \row - * \li Pinch \li Zoom in/out within default range (10...500%). - * \row - * \li Tap on the primary view when the secondary view is visible - * \li Closes the secondary view. - * \note Secondary view is available only for Q3DBars and Q3DSurface graphs. + * \header + * \li Gesture + * \li Action + * \row + * \li Touch-And-Move + * \li Rotate graph within limits set for Q3DCamera + * \row + * \li Tap + * \li Select the item tapped or remove selection if none. + * May open the secondary view depending on the + * \l {QAbstract3DGraph::selectionMode}{selection mode}. + * \row + * \li Tap-And-Hold + * \li Same as tap. + * \row + * \li Pinch + * \li Zoom in/out within default range (10...500%). + * \row + * \li Tap on the primary view when the secondary view is visible + * \li Closes the secondary view. + * \note Secondary view is available only for Q3DBars and Q3DSurface graphs. * \endtable */ @@ -111,14 +116,14 @@ void QTouch3DInputHandler::touchEvent(QTouchEvent *event) d_ptr->m_holdTimer->start(); setInputView(InputViewOnPrimary); // Start rotating - setInputState(InputStateRotating); + d_ptr->m_inputState = QAbstract3DInputHandlerPrivate::InputStateRotating; setInputPosition(pointerPos.toPoint()); } } else if (event->type() == QEvent::TouchEnd) { setInputView(InputViewNone); d_ptr->m_holdTimer->stop(); // Handle possible selection - if (QAbstract3DInputHandler::InputStatePinching != inputState()) + if (QAbstract3DInputHandlerPrivate::InputStatePinching != d_ptr->m_inputState) d_ptr->handleSelection(pointerPos); } else if (event->type() == QEvent::TouchUpdate) { if (!scene()->isSlicingActive()) { @@ -134,7 +139,8 @@ void QTouch3DInputHandler::touchEvent(QTouchEvent *event) QTouch3DInputHandlerPrivate::QTouch3DInputHandlerPrivate(QTouch3DInputHandler *q) : q_ptr(q), - m_holdTimer(0) + m_holdTimer(0), + m_inputState(QAbstract3DInputHandlerPrivate::InputStateNone) { m_holdTimer = new QTimer(); m_holdTimer->setSingleShot(true); @@ -154,7 +160,7 @@ void QTouch3DInputHandlerPrivate::handlePinchZoom(float distance) int prevDist = q_ptr->prevDistance(); if (prevDist > 0 && qAbs(prevDist - newDistance) < maxPinchJitter) return; - q_ptr->setInputState(QAbstract3DInputHandler::InputStatePinching); + m_inputState = QAbstract3DInputHandlerPrivate::InputStatePinching; Q3DCamera *camera = q_ptr->scene()->activeCamera(); int zoomLevel = camera->zoomLevel(); float zoomRate = qSqrt(qSqrt(zoomLevel)); @@ -176,7 +182,7 @@ void QTouch3DInputHandlerPrivate::handleTapAndHold() if (distance.manhattanLength() < maxTapAndHoldJitter) { q_ptr->setInputPosition(m_touchHoldPos.toPoint()); q_ptr->scene()->setSelectionQueryPosition(m_touchHoldPos.toPoint()); - q_ptr->setInputState(QAbstract3DInputHandler::InputStateSelecting); + m_inputState = QAbstract3DInputHandlerPrivate::InputStateSelecting; } } @@ -184,10 +190,10 @@ void QTouch3DInputHandlerPrivate::handleSelection(const QPointF &position) { QPointF distance = m_startHoldPos - position; if (distance.manhattanLength() < maxSelectionJitter) { - q_ptr->setInputState(QAbstract3DInputHandler::InputStateSelecting); + m_inputState = QAbstract3DInputHandlerPrivate::InputStateSelecting; q_ptr->scene()->setSelectionQueryPosition(position.toPoint()); } else { - q_ptr->setInputState(QAbstract3DInputHandler::InputStateNone); + m_inputState = QAbstract3DInputHandlerPrivate::InputStateNone; q_ptr->setInputView(QAbstract3DInputHandler::InputViewNone); } q_ptr->setPreviousInputPos(position.toPoint()); @@ -195,7 +201,7 @@ void QTouch3DInputHandlerPrivate::handleSelection(const QPointF &position) void QTouch3DInputHandlerPrivate::handleRotation(const QPointF &position) { - if (QAbstract3DInputHandler::InputStateRotating == q_ptr->inputState()) { + if (QAbstract3DInputHandlerPrivate::InputStateRotating == m_inputState) { Q3DScene *scene = q_ptr->scene(); Q3DCamera *camera = scene->activeCamera(); float xRotation = camera->xRotation(); -- cgit v1.2.3