void MouseMachine::slotDoubleTap() { qDebug() << "--- slotDoubleTap " << curPos << " : " << theParent->mapFromGlobal(QCursor::pos()); tapHoldTimer.stop(); dblclickTimer.stop(); #ifdef Q_OS_SYMBIAN iTouchFeedback->InstantFeedback(ETouchFeedbackBasic); #endif emit doubleTap(firstPress); }
void DoubleTapDetector::initGesture(const Positions& positions) { if (!_canBeDoubleTap) { // adding initial points if (positions.size() > _touchStartPos.size()) { if (_touchStartPos.empty()) _startGesture(positions); else _touchStartPos = positions; return; } // all points released, decide if potential double tap or abort if (positions.empty()) { _canBeDoubleTap = _doubleTapTimer.isActive(); if (!_canBeDoubleTap) cancelGesture(); } return; } // points pressed again, check for double tap if (positions.size() == _touchStartPos.size() && !MathUtils::hasMoved(positions, _touchStartPos, _doubleTapThresholdPx)) { emit doubleTap(MathUtils::computeCenter(_touchStartPos), _touchStartPos.size()); _doubleTapTimer.stop(); } // all points released, reset everything for next detection if (positions.empty()) cancelGesture(); }