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/qquickcombobox.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/qquickcombobox.cpp')
-rw-r--r-- | src/quicktemplates2/qquickcombobox.cpp | 102 |
1 files changed, 10 insertions, 92 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index 5c763d21..c2fc3aff 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -243,10 +243,10 @@ public: void createDelegateModel(); - 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 flat; bool down; @@ -627,21 +627,24 @@ void QQuickComboBoxPrivate::createDelegateModel() delete oldModel; } -void QQuickComboBoxPrivate::handlePress(const QPointF &) +void QQuickComboBoxPrivate::handlePress(const QPointF &point) { Q_Q(QQuickComboBox); + QQuickControlPrivate::handlePress(point); q->setPressed(true); } void QQuickComboBoxPrivate::handleMove(const QPointF &point) { Q_Q(QQuickComboBox); + QQuickControlPrivate::handleMove(point); q->setPressed(q->contains(point)); } -void QQuickComboBoxPrivate::handleRelease(const QPointF &) +void QQuickComboBoxPrivate::handleRelease(const QPointF &point) { Q_Q(QQuickComboBox); + QQuickControlPrivate::handleRelease(point); if (pressed) { q->setPressed(false); togglePopup(false); @@ -651,6 +654,7 @@ void QQuickComboBoxPrivate::handleRelease(const QPointF &) void QQuickComboBoxPrivate::handleUngrab() { Q_Q(QQuickComboBox); + QQuickControlPrivate::handleUngrab(); q->setPressed(false); } @@ -1503,92 +1507,6 @@ void QQuickComboBox::keyReleaseEvent(QKeyEvent *event) } } -void QQuickComboBox::mousePressEvent(QMouseEvent *event) -{ - Q_D(QQuickComboBox); - QQuickControl::mousePressEvent(event); - d->handlePress(event->localPos()); -} - -void QQuickComboBox::mouseMoveEvent(QMouseEvent* event) -{ - Q_D(QQuickComboBox); - QQuickControl::mouseMoveEvent(event); - d->handleMove(event->localPos()); -} - -void QQuickComboBox::mouseReleaseEvent(QMouseEvent *event) -{ - Q_D(QQuickComboBox); - QQuickControl::mouseReleaseEvent(event); - d->handleRelease(event->localPos()); -} - -void QQuickComboBox::mouseUngrabEvent() -{ - Q_D(QQuickComboBox); - QQuickControl::mouseUngrabEvent(); - d->handleUngrab(); -} - -void QQuickComboBox::touchEvent(QTouchEvent *event) -{ - Q_D(QQuickComboBox); - 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()); - } - break; - - case QEvent::TouchUpdate: - for (const QTouchEvent::TouchPoint &point : event->touchPoints()) { - if (point.id() != d->touchId) - continue; - - switch (point.state()) { - case Qt::TouchPointPressed: - d->handlePress(point.pos()); - break; - case Qt::TouchPointMoved: - d->handleMove(point.pos()); - break; - case Qt::TouchPointReleased: - d->handleRelease(point.pos()); - break; - default: - break; - } - } - break; - - case QEvent::TouchEnd: - for (const QTouchEvent::TouchPoint &point : event->touchPoints()) { - if (point.id() == d->touchId) - d->handleRelease(point.pos()); - } - break; - - case QEvent::TouchCancel: - d->handleUngrab(); - break; - - default: - break; - } - - QQuickControl::touchEvent(event); -} - -void QQuickComboBox::touchUngrabEvent() -{ - Q_D(QQuickComboBox); - QQuickControl::touchUngrabEvent(); - d->handleUngrab(); -} - #if QT_CONFIG(wheelevent) void QQuickComboBox::wheelEvent(QWheelEvent *event) { |