diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-04-19 17:30:08 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-04-20 09:47:27 +0000 |
commit | 9ba2c26a54b8180a822ab23b85fa2967bfa05683 (patch) | |
tree | 50510177339046269d1b799ff8a87a8304ee0f74 /src/quicktemplates2/qquickspinbox.cpp | |
parent | 508df25faab2adb1565b2ac8a92a0cf768add69f (diff) |
Override QQuickControlPrivate::handleXxx()
Change-Id: I5c5be24142a758637e18df24b43847a8c6079346
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Diffstat (limited to 'src/quicktemplates2/qquickspinbox.cpp')
-rw-r--r-- | src/quicktemplates2/qquickspinbox.cpp | 90 |
1 files changed, 8 insertions, 82 deletions
diff --git a/src/quicktemplates2/qquickspinbox.cpp b/src/quicktemplates2/qquickspinbox.cpp index 3303ded7..b6e99609 100644 --- a/src/quicktemplates2/qquickspinbox.cpp +++ b/src/quicktemplates2/qquickspinbox.cpp @@ -137,10 +137,10 @@ public: void startPressRepeat(); void stopPressRepeat(); - void handlePress(const QPointF &point); - void handleMove(const QPointF &point); - void handleRelease(const QPointF &point); - void handleUngrab(); + void handlePress(const QPointF &point) override; + void handleMove(const QPointF &point) override; + void handleRelease(const QPointF &point) override; + void handleUngrab() override; bool editable; int from; @@ -274,6 +274,7 @@ void QQuickSpinBoxPrivate::stopPressRepeat() void QQuickSpinBoxPrivate::handlePress(const QPointF &point) { Q_Q(QQuickSpinBox); + QQuickControlPrivate::handlePress(point); QQuickItem *ui = up->indicator(); QQuickItem *di = down->indicator(); up->setPressed(ui && ui->isEnabled() && ui->contains(ui->mapFromItem(q, point))); @@ -288,6 +289,7 @@ void QQuickSpinBoxPrivate::handlePress(const QPointF &point) void QQuickSpinBoxPrivate::handleMove(const QPointF &point) { Q_Q(QQuickSpinBox); + QQuickControlPrivate::handleMove(point); QQuickItem *ui = up->indicator(); QQuickItem *di = down->indicator(); up->setPressed(ui && ui->isEnabled() && ui->contains(ui->mapFromItem(q, point))); @@ -302,6 +304,7 @@ void QQuickSpinBoxPrivate::handleMove(const QPointF &point) void QQuickSpinBoxPrivate::handleRelease(const QPointF &point) { Q_Q(QQuickSpinBox); + QQuickControlPrivate::handleRelease(point); QQuickItem *ui = up->indicator(); QQuickItem *di = down->indicator(); @@ -325,6 +328,7 @@ void QQuickSpinBoxPrivate::handleRelease(const QPointF &point) void QQuickSpinBoxPrivate::handleUngrab() { Q_Q(QQuickSpinBox); + QQuickControlPrivate::handleUngrab(); up->setPressed(false); down->setPressed(false); @@ -782,34 +786,6 @@ void QQuickSpinBox::keyReleaseEvent(QKeyEvent *event) setAccessibleProperty("pressed", false); } -void QQuickSpinBox::mousePressEvent(QMouseEvent *event) -{ - Q_D(QQuickSpinBox); - QQuickControl::mousePressEvent(event); - d->handlePress(event->localPos()); -} - -void QQuickSpinBox::mouseMoveEvent(QMouseEvent *event) -{ - Q_D(QQuickSpinBox); - QQuickControl::mouseMoveEvent(event); - d->handleMove(event->localPos()); -} - -void QQuickSpinBox::mouseReleaseEvent(QMouseEvent *event) -{ - Q_D(QQuickSpinBox); - QQuickControl::mouseReleaseEvent(event); - d->handleRelease(event->localPos()); -} - -void QQuickSpinBox::mouseUngrabEvent() -{ - Q_D(QQuickSpinBox); - QQuickControl::mouseUngrabEvent(); - d->handleUngrab(); -} - void QQuickSpinBox::timerEvent(QTimerEvent *event) { Q_D(QQuickSpinBox); @@ -824,56 +800,6 @@ void QQuickSpinBox::timerEvent(QTimerEvent *event) } } -void QQuickSpinBox::touchEvent(QTouchEvent *event) -{ - Q_D(QQuickSpinBox); - switch (event->type()) { - case QEvent::TouchBegin: - if (d->touchId == -1) { - const QTouchEvent::TouchPoint point = event->touchPoints().first(); - d->touchId = point.id(); - d->handlePress(point.pos()); - } else { - event->ignore(); - } - break; - - case QEvent::TouchUpdate: - for (const QTouchEvent::TouchPoint &point : event->touchPoints()) { - if (point.id() != d->touchId) - continue; - - d->handleMove(point.pos()); - } - break; - - case QEvent::TouchEnd: - for (const QTouchEvent::TouchPoint &point : event->touchPoints()) { - if (point.id() != d->touchId) - continue; - - d->handleRelease(point.pos()); - } - break; - - case QEvent::TouchCancel: - d->handleUngrab(); - break; - - default: - break; - } - - QQuickControl::touchEvent(event); -} - -void QQuickSpinBox::touchUngrabEvent() -{ - Q_D(QQuickSpinBox); - QQuickControl::touchUngrabEvent(); - d->handleUngrab(); -} - #if QT_CONFIG(wheelevent) void QQuickSpinBox::wheelEvent(QWheelEvent *event) { |