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>
This commit is contained in:
parent
508df25faa
commit
9ba2c26a54
|
@ -133,6 +133,7 @@ QQuickAbstractButtonPrivate::QQuickAbstractButtonPrivate()
|
|||
void QQuickAbstractButtonPrivate::handlePress(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickAbstractButton);
|
||||
QQuickControlPrivate::handlePress(point);
|
||||
pressPoint = point;
|
||||
q->setPressed(true);
|
||||
|
||||
|
@ -149,6 +150,7 @@ void QQuickAbstractButtonPrivate::handlePress(const QPointF &point)
|
|||
void QQuickAbstractButtonPrivate::handleMove(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickAbstractButton);
|
||||
QQuickControlPrivate::handleMove(point);
|
||||
q->setPressed(keepPressed || q->contains(point));
|
||||
|
||||
if (!pressed && autoRepeat)
|
||||
|
@ -160,6 +162,7 @@ void QQuickAbstractButtonPrivate::handleMove(const QPointF &point)
|
|||
void QQuickAbstractButtonPrivate::handleRelease(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickAbstractButton);
|
||||
QQuickControlPrivate::handleRelease(point);
|
||||
bool wasPressed = pressed;
|
||||
q->setPressed(false);
|
||||
pressButtons = Qt::NoButton;
|
||||
|
@ -184,6 +187,7 @@ void QQuickAbstractButtonPrivate::handleRelease(const QPointF &point)
|
|||
void QQuickAbstractButtonPrivate::handleUngrab()
|
||||
{
|
||||
Q_Q(QQuickAbstractButton);
|
||||
QQuickControlPrivate::handleUngrab();
|
||||
pressButtons = Qt::NoButton;
|
||||
if (!pressed)
|
||||
return;
|
||||
|
@ -616,23 +620,8 @@ void QQuickAbstractButton::keyReleaseEvent(QKeyEvent *event)
|
|||
void QQuickAbstractButton::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickAbstractButton);
|
||||
QQuickControl::mousePressEvent(event);
|
||||
d->pressButtons = event->buttons();
|
||||
d->handlePress(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickAbstractButton::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickAbstractButton);
|
||||
QQuickControl::mouseMoveEvent(event);
|
||||
d->handleMove(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickAbstractButton::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickAbstractButton);
|
||||
QQuickControl::mouseReleaseEvent(event);
|
||||
d->handleRelease(event->localPos());
|
||||
QQuickControl::mousePressEvent(event);
|
||||
}
|
||||
|
||||
void QQuickAbstractButton::mouseDoubleClickEvent(QMouseEvent *event)
|
||||
|
@ -641,13 +630,6 @@ void QQuickAbstractButton::mouseDoubleClickEvent(QMouseEvent *event)
|
|||
emit doubleClicked();
|
||||
}
|
||||
|
||||
void QQuickAbstractButton::mouseUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickAbstractButton);
|
||||
QQuickControl::mouseUngrabEvent();
|
||||
d->handleUngrab();
|
||||
}
|
||||
|
||||
void QQuickAbstractButton::timerEvent(QTimerEvent *event)
|
||||
{
|
||||
Q_D(QQuickAbstractButton);
|
||||
|
@ -665,64 +647,6 @@ void QQuickAbstractButton::timerEvent(QTimerEvent *event)
|
|||
}
|
||||
}
|
||||
|
||||
void QQuickAbstractButton::touchEvent(QTouchEvent *event)
|
||||
{
|
||||
Q_D(QQuickAbstractButton);
|
||||
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 QQuickAbstractButton::touchUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickAbstractButton);
|
||||
QQuickControl::touchUngrabEvent();
|
||||
d->handleUngrab();
|
||||
}
|
||||
|
||||
void QQuickAbstractButton::buttonChange(ButtonChange change)
|
||||
{
|
||||
Q_D(QQuickAbstractButton);
|
||||
|
|
|
@ -120,13 +120,8 @@ protected:
|
|||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseDoubleClickEvent(QMouseEvent *event) override;
|
||||
void mouseUngrabEvent() override;
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
void touchEvent(QTouchEvent *event) override;
|
||||
void touchUngrabEvent() override;
|
||||
|
||||
enum ButtonChange {
|
||||
ButtonAutoRepeatChange,
|
||||
|
|
|
@ -67,10 +67,10 @@ public:
|
|||
return button->d_func();
|
||||
}
|
||||
|
||||
virtual void handlePress(const QPointF &point);
|
||||
virtual void handleMove(const QPointF &point);
|
||||
virtual void handleRelease(const QPointF &point);
|
||||
virtual void handleUngrab();
|
||||
void handlePress(const QPointF &point) override;
|
||||
void handleMove(const QPointF &point) override;
|
||||
void handleRelease(const QPointF &point) override;
|
||||
void handleUngrab() override;
|
||||
|
||||
bool isPressAndHoldConnected();
|
||||
void startPressAndHold();
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -183,12 +183,6 @@ protected:
|
|||
#endif
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseUngrabEvent() override;
|
||||
void touchEvent(QTouchEvent *event) override;
|
||||
void touchUngrabEvent() override;
|
||||
#if QT_CONFIG(wheelevent)
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
#endif
|
||||
|
|
|
@ -145,6 +145,19 @@ QQuickControlPrivate::~QQuickControlPrivate()
|
|||
#endif
|
||||
}
|
||||
|
||||
bool QQuickControlPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
|
||||
{
|
||||
if (point.id() == touchId)
|
||||
return true;
|
||||
|
||||
if (touchId == -1 && point.state() == Qt::TouchPointPressed) {
|
||||
touchId = point.id();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QQuickControlPrivate::handlePress(const QPointF &)
|
||||
{
|
||||
Q_Q(QQuickControl);
|
||||
|
@ -1348,14 +1361,14 @@ void QQuickControl::touchEvent(QTouchEvent *event)
|
|||
switch (event->type()) {
|
||||
case QEvent::TouchBegin:
|
||||
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
|
||||
if (point.id() == d->touchId)
|
||||
if (d->acceptTouch(point))
|
||||
d->handlePress(point.pos());
|
||||
}
|
||||
break;
|
||||
|
||||
case QEvent::TouchUpdate:
|
||||
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
|
||||
if (point.id() != d->touchId)
|
||||
if (!d->acceptTouch(point))
|
||||
continue;
|
||||
|
||||
switch (point.state()) {
|
||||
|
@ -1376,7 +1389,7 @@ void QQuickControl::touchEvent(QTouchEvent *event)
|
|||
|
||||
case QEvent::TouchEnd:
|
||||
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
|
||||
if (point.id() == d->touchId)
|
||||
if (d->acceptTouch(point))
|
||||
d->handleRelease(point.pos());
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -78,10 +78,11 @@ public:
|
|||
return control->d_func();
|
||||
}
|
||||
|
||||
void handlePress(const QPointF &point);
|
||||
void handleMove(const QPointF &point);
|
||||
void handleRelease(const QPointF &point);
|
||||
void handleUngrab();
|
||||
virtual bool acceptTouch(const QTouchEvent::TouchPoint &point);
|
||||
virtual void handlePress(const QPointF &point);
|
||||
virtual void handleMove(const QPointF &point);
|
||||
virtual void handleRelease(const QPointF &point);
|
||||
virtual void handleUngrab();
|
||||
|
||||
void mirrorChange() override;
|
||||
|
||||
|
|
|
@ -117,10 +117,10 @@ public:
|
|||
void updatePosition();
|
||||
bool isLargeChange(const QPointF &eventPos, qreal proposedPosition) const;
|
||||
|
||||
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;
|
||||
|
||||
qreal from;
|
||||
qreal to;
|
||||
|
@ -198,6 +198,7 @@ bool QQuickDialPrivate::isLargeChange(const QPointF &eventPos, qreal proposedPos
|
|||
void QQuickDialPrivate::handlePress(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickDial);
|
||||
QQuickControlPrivate::handlePress(point);
|
||||
pressPoint = point;
|
||||
q->setPressed(true);
|
||||
}
|
||||
|
@ -205,6 +206,7 @@ void QQuickDialPrivate::handlePress(const QPointF &point)
|
|||
void QQuickDialPrivate::handleMove(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickDial);
|
||||
QQuickControlPrivate::handleMove(point);
|
||||
const qreal oldPos = position;
|
||||
qreal pos = positionAt(point);
|
||||
if (snapMode == QQuickDial::SnapAlways)
|
||||
|
@ -223,6 +225,7 @@ void QQuickDialPrivate::handleMove(const QPointF &point)
|
|||
void QQuickDialPrivate::handleRelease(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickDial);
|
||||
QQuickControlPrivate::handleRelease(point);
|
||||
if (q->keepMouseGrab() || q->keepTouchGrab()) {
|
||||
const qreal oldPos = position;
|
||||
qreal pos = positionAt(point);
|
||||
|
@ -245,6 +248,7 @@ void QQuickDialPrivate::handleRelease(const QPointF &point)
|
|||
void QQuickDialPrivate::handleUngrab()
|
||||
{
|
||||
Q_Q(QQuickDial);
|
||||
QQuickControlPrivate::handleUngrab();
|
||||
pressPoint = QPointF();
|
||||
q->setPressed(false);
|
||||
}
|
||||
|
@ -644,14 +648,12 @@ void QQuickDial::mousePressEvent(QMouseEvent *event)
|
|||
{
|
||||
Q_D(QQuickDial);
|
||||
QQuickControl::mousePressEvent(event);
|
||||
d->handlePress(event->localPos());
|
||||
d->handleMove(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickDial::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickDial);
|
||||
QQuickControl::mouseMoveEvent(event);
|
||||
if (!keepMouseGrab()) {
|
||||
bool overXDragThreshold = QQuickWindowPrivate::dragOverThreshold(event->localPos().x() - d->pressPoint.x(), Qt::XAxis, event);
|
||||
setKeepMouseGrab(overXDragThreshold);
|
||||
|
@ -661,81 +663,44 @@ void QQuickDial::mouseMoveEvent(QMouseEvent *event)
|
|||
setKeepMouseGrab(overYDragThreshold);
|
||||
}
|
||||
}
|
||||
d->handleMove(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickDial::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickDial);
|
||||
QQuickControl::mouseReleaseEvent(event);
|
||||
d->handleRelease(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickDial::mouseUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickDial);
|
||||
QQuickControl::mouseUngrabEvent();
|
||||
d->handleUngrab();
|
||||
QQuickControl::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void QQuickDial::touchEvent(QTouchEvent *event)
|
||||
{
|
||||
Q_D(QQuickDial);
|
||||
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)
|
||||
if (!d->acceptTouch(point))
|
||||
continue;
|
||||
|
||||
if (!keepTouchGrab()) {
|
||||
bool overXDragThreshold = QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point);
|
||||
setKeepTouchGrab(overXDragThreshold);
|
||||
switch (point.state()) {
|
||||
case Qt::TouchPointMoved:
|
||||
if (!keepTouchGrab()) {
|
||||
bool overXDragThreshold = QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point);
|
||||
setKeepTouchGrab(overXDragThreshold);
|
||||
|
||||
if (!overXDragThreshold) {
|
||||
bool overYDragThreshold = QQuickWindowPrivate::dragOverThreshold(point.pos().y() - d->pressPoint.y(), Qt::YAxis, &point);
|
||||
setKeepTouchGrab(overYDragThreshold);
|
||||
if (!overXDragThreshold) {
|
||||
bool overYDragThreshold = QQuickWindowPrivate::dragOverThreshold(point.pos().y() - d->pressPoint.y(), Qt::YAxis, &point);
|
||||
setKeepTouchGrab(overYDragThreshold);
|
||||
}
|
||||
}
|
||||
if (keepTouchGrab())
|
||||
d->handleMove(point.pos());
|
||||
break;
|
||||
|
||||
default:
|
||||
QQuickControl::touchEvent(event);
|
||||
break;
|
||||
}
|
||||
if (keepTouchGrab())
|
||||
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:
|
||||
QQuickControl::touchEvent(event);
|
||||
break;
|
||||
}
|
||||
|
||||
QQuickControl::touchEvent(event);
|
||||
}
|
||||
|
||||
void QQuickDial::touchUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickDial);
|
||||
QQuickControl::touchUngrabEvent();
|
||||
d->handleUngrab();
|
||||
}
|
||||
|
||||
#if QT_CONFIG(wheelevent)
|
||||
|
|
|
@ -136,10 +136,7 @@ protected:
|
|||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseUngrabEvent() override;
|
||||
void touchEvent(QTouchEvent *event) override;
|
||||
void touchUngrabEvent() override;
|
||||
#if QT_CONFIG(wheelevent)
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
#endif
|
||||
|
|
|
@ -327,10 +327,12 @@ public:
|
|||
}
|
||||
|
||||
QQuickRangeSliderNode *pressedNode(int touchId = -1) const;
|
||||
void handlePress(const QPointF &point, int touchId = -1);
|
||||
void handleMove(const QPointF &point, int touchId = -1);
|
||||
void handleRelease(const QPointF &point, int touchId = -1);
|
||||
void handleUngrab();
|
||||
|
||||
bool acceptTouch(const QTouchEvent::TouchPoint &point) override;
|
||||
void handlePress(const QPointF &point) override;
|
||||
void handleMove(const QPointF &point) override;
|
||||
void handleRelease(const QPointF &point) override;
|
||||
void handleUngrab() override;
|
||||
|
||||
void updateHover(const QPointF &pos);
|
||||
|
||||
|
@ -395,9 +397,23 @@ QQuickRangeSliderNode *QQuickRangeSliderPrivate::pressedNode(int touchId) const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void QQuickRangeSliderPrivate::handlePress(const QPointF &point, int touchId)
|
||||
bool QQuickRangeSliderPrivate::acceptTouch(const QTouchEvent::TouchPoint &point)
|
||||
{
|
||||
int firstId = QQuickRangeSliderNodePrivate::get(first)->touchId;
|
||||
int secondId = QQuickRangeSliderNodePrivate::get(second)->touchId;
|
||||
|
||||
if (((firstId == -1 || secondId == -1) && point.state() == Qt::TouchPointPressed) || point.id() == firstId || point.id() == secondId) {
|
||||
touchId = point.id();
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
void QQuickRangeSliderPrivate::handlePress(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickRangeSlider);
|
||||
QQuickControlPrivate::handlePress(point);
|
||||
pressPoint = point;
|
||||
|
||||
QQuickItem *firstHandle = first->handle();
|
||||
|
@ -453,9 +469,10 @@ void QQuickRangeSliderPrivate::handlePress(const QPointF &point, int touchId)
|
|||
otherNode->handle()->setZ(0);
|
||||
}
|
||||
|
||||
void QQuickRangeSliderPrivate::handleMove(const QPointF &point, int touchId)
|
||||
void QQuickRangeSliderPrivate::handleMove(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickRangeSlider);
|
||||
QQuickControlPrivate::handleMove(point);
|
||||
QQuickRangeSliderNode *pressedNode = QQuickRangeSliderPrivate::pressedNode(touchId);
|
||||
if (pressedNode) {
|
||||
qreal pos = positionAt(q, pressedNode->handle(), point);
|
||||
|
@ -468,9 +485,10 @@ void QQuickRangeSliderPrivate::handleMove(const QPointF &point, int touchId)
|
|||
}
|
||||
}
|
||||
|
||||
void QQuickRangeSliderPrivate::handleRelease(const QPointF &point, int touchId)
|
||||
void QQuickRangeSliderPrivate::handleRelease(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickRangeSlider);
|
||||
QQuickControlPrivate::handleRelease(point);
|
||||
pressPoint = QPointF();
|
||||
|
||||
QQuickRangeSliderNode *pressedNode = QQuickRangeSliderPrivate::pressedNode(touchId);
|
||||
|
@ -496,6 +514,7 @@ void QQuickRangeSliderPrivate::handleRelease(const QPointF &point, int touchId)
|
|||
|
||||
void QQuickRangeSliderPrivate::handleUngrab()
|
||||
{
|
||||
QQuickControlPrivate::handleUngrab();
|
||||
pressPoint = QPointF();
|
||||
first->setPressed(false);
|
||||
second->setPressed(false);
|
||||
|
@ -950,57 +969,33 @@ void QQuickRangeSlider::mousePressEvent(QMouseEvent *event)
|
|||
{
|
||||
Q_D(QQuickRangeSlider);
|
||||
QQuickControl::mousePressEvent(event);
|
||||
d->handlePress(event->localPos());
|
||||
d->handleMove(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickRangeSlider::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickRangeSlider);
|
||||
QQuickControl::mouseMoveEvent(event);
|
||||
if (!keepMouseGrab()) {
|
||||
if (d->orientation == Qt::Horizontal)
|
||||
setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->localPos().x() - d->pressPoint.x(), Qt::XAxis, event));
|
||||
else
|
||||
setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->localPos().y() - d->pressPoint.y(), Qt::YAxis, event));
|
||||
}
|
||||
if (keepMouseGrab())
|
||||
d->handleMove(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickRangeSlider::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickRangeSlider);
|
||||
QQuickControl::mouseReleaseEvent(event);
|
||||
d->handleRelease(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickRangeSlider::mouseUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickRangeSlider);
|
||||
QQuickControl::mouseUngrabEvent();
|
||||
d->handleUngrab();
|
||||
QQuickControl::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void QQuickRangeSlider::touchEvent(QTouchEvent *event)
|
||||
{
|
||||
Q_D(QQuickRangeSlider);
|
||||
switch (event->type()) {
|
||||
case QEvent::TouchBegin:
|
||||
if (!d->first->isPressed() || !d->second->isPressed()) {
|
||||
const QTouchEvent::TouchPoint point = event->touchPoints().first();
|
||||
d->handlePress(point.pos(), point.id());
|
||||
} else {
|
||||
event->ignore();
|
||||
}
|
||||
break;
|
||||
|
||||
case QEvent::TouchUpdate:
|
||||
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
|
||||
if (!d->acceptTouch(point))
|
||||
continue;
|
||||
|
||||
switch (point.state()) {
|
||||
case Qt::TouchPointPressed:
|
||||
if (!d->first->isPressed() || !d->second->isPressed())
|
||||
d->handlePress(point.pos(), point.id());
|
||||
d->handlePress(point.pos());
|
||||
break;
|
||||
case Qt::TouchPointMoved:
|
||||
if (!keepTouchGrab()) {
|
||||
|
@ -1009,14 +1004,11 @@ void QQuickRangeSlider::touchEvent(QTouchEvent *event)
|
|||
else
|
||||
setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - point.startPos().y(), Qt::YAxis, &point));
|
||||
}
|
||||
if (point.id() == QQuickRangeSliderNodePrivate::get(d->first)->touchId
|
||||
|| point.id() == QQuickRangeSliderNodePrivate::get(d->second)->touchId)
|
||||
d->handleMove(point.pos(), point.id());
|
||||
if (keepTouchGrab())
|
||||
d->handleMove(point.pos());
|
||||
break;
|
||||
case Qt::TouchPointReleased:
|
||||
if (point.id() == QQuickRangeSliderNodePrivate::get(d->first)->touchId
|
||||
|| point.id() == QQuickRangeSliderNodePrivate::get(d->second)->touchId)
|
||||
d->handleRelease(point.pos(), point.id());
|
||||
d->handleRelease(point.pos());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1024,31 +1016,12 @@ void QQuickRangeSlider::touchEvent(QTouchEvent *event)
|
|||
}
|
||||
break;
|
||||
|
||||
case QEvent::TouchEnd:
|
||||
for (const QTouchEvent::TouchPoint &point : event->touchPoints()) {
|
||||
if (point.id() == QQuickRangeSliderNodePrivate::get(d->first)->touchId
|
||||
|| point.id() == QQuickRangeSliderNodePrivate::get(d->second)->touchId)
|
||||
d->handleRelease(point.pos(), point.id());
|
||||
}
|
||||
break;
|
||||
|
||||
case QEvent::TouchCancel:
|
||||
d->handleUngrab();
|
||||
break;
|
||||
|
||||
default:
|
||||
QQuickControl::touchEvent(event);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void QQuickRangeSlider::touchUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickRangeSlider);
|
||||
QQuickControl::touchUngrabEvent();
|
||||
d->handleUngrab();
|
||||
}
|
||||
|
||||
void QQuickRangeSlider::mirrorChange()
|
||||
{
|
||||
Q_D(QQuickRangeSlider);
|
||||
|
|
|
@ -117,10 +117,7 @@ protected:
|
|||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseUngrabEvent() override;
|
||||
void touchEvent(QTouchEvent *event) override;
|
||||
void touchUngrabEvent() override;
|
||||
void mirrorChange() override;
|
||||
void componentComplete() override;
|
||||
|
||||
|
|
|
@ -245,6 +245,7 @@ void QQuickScrollBarPrivate::resizeContent()
|
|||
void QQuickScrollBarPrivate::handlePress(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickScrollBar);
|
||||
QQuickControlPrivate::handlePress(point);
|
||||
offset = positionAt(point) - position;
|
||||
if (offset < 0 || offset > size)
|
||||
offset = size / 2;
|
||||
|
@ -254,6 +255,7 @@ void QQuickScrollBarPrivate::handlePress(const QPointF &point)
|
|||
void QQuickScrollBarPrivate::handleMove(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickScrollBar);
|
||||
QQuickControlPrivate::handleMove(point);
|
||||
qreal pos = qBound<qreal>(0.0, positionAt(point) - offset, 1.0 - size);
|
||||
if (snapMode == QQuickScrollBar::SnapAlways)
|
||||
pos = snapPosition(pos);
|
||||
|
@ -263,6 +265,7 @@ void QQuickScrollBarPrivate::handleMove(const QPointF &point)
|
|||
void QQuickScrollBarPrivate::handleRelease(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickScrollBar);
|
||||
QQuickControlPrivate::handleRelease(point);
|
||||
qreal pos = qBound<qreal>(0.0, positionAt(point) - offset, 1.0 - size);
|
||||
if (snapMode != QQuickScrollBar::NoSnap)
|
||||
pos = snapPosition(pos);
|
||||
|
@ -274,6 +277,7 @@ void QQuickScrollBarPrivate::handleRelease(const QPointF &point)
|
|||
void QQuickScrollBarPrivate::handleUngrab()
|
||||
{
|
||||
Q_Q(QQuickScrollBar);
|
||||
QQuickControlPrivate::handleUngrab();
|
||||
offset = 0.0;
|
||||
q->setPressed(false);
|
||||
}
|
||||
|
@ -592,81 +596,9 @@ void QQuickScrollBar::mousePressEvent(QMouseEvent *event)
|
|||
{
|
||||
Q_D(QQuickScrollBar);
|
||||
QQuickControl::mousePressEvent(event);
|
||||
d->handlePress(event->localPos());
|
||||
d->handleMove(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickScrollBar::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickScrollBar);
|
||||
QQuickControl::mouseMoveEvent(event);
|
||||
d->handleMove(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickScrollBar::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickScrollBar);
|
||||
QQuickControl::mouseReleaseEvent(event);
|
||||
d->handleRelease(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickScrollBar::mouseUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickScrollBar);
|
||||
QQuickControl::mouseUngrabEvent();
|
||||
d->handleUngrab();
|
||||
}
|
||||
|
||||
void QQuickScrollBar::touchEvent(QTouchEvent *event)
|
||||
{
|
||||
Q_D(QQuickScrollBar);
|
||||
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 QQuickScrollBar::touchUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickScrollBar);
|
||||
QQuickControl::touchUngrabEvent();
|
||||
d->handleUngrab();
|
||||
}
|
||||
|
||||
#if QT_CONFIG(quicktemplates2_hover)
|
||||
void QQuickScrollBar::hoverChange()
|
||||
{
|
||||
|
|
|
@ -131,11 +131,6 @@ Q_SIGNALS:
|
|||
|
||||
protected:
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseUngrabEvent() override;
|
||||
void touchEvent(QTouchEvent *event) override;
|
||||
void touchUngrabEvent() override;
|
||||
|
||||
#if QT_CONFIG(quicktemplates2_hover)
|
||||
void hoverChange() override;
|
||||
|
|
|
@ -74,10 +74,10 @@ public:
|
|||
void updateActive();
|
||||
void resizeContent() override;
|
||||
|
||||
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;
|
||||
|
||||
qreal size;
|
||||
qreal position;
|
||||
|
|
|
@ -107,10 +107,10 @@ public:
|
|||
void setPosition(qreal position);
|
||||
void updatePosition();
|
||||
|
||||
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;
|
||||
|
||||
qreal from;
|
||||
qreal to;
|
||||
|
@ -185,6 +185,7 @@ void QQuickSliderPrivate::updatePosition()
|
|||
void QQuickSliderPrivate::handlePress(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickSlider);
|
||||
QQuickControlPrivate::handlePress(point);
|
||||
pressPoint = point;
|
||||
q->setPressed(true);
|
||||
}
|
||||
|
@ -192,6 +193,7 @@ void QQuickSliderPrivate::handlePress(const QPointF &point)
|
|||
void QQuickSliderPrivate::handleMove(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickSlider);
|
||||
QQuickControlPrivate::handleMove(point);
|
||||
const qreal oldPos = position;
|
||||
qreal pos = positionAt(point);
|
||||
if (snapMode == QQuickSlider::SnapAlways)
|
||||
|
@ -207,6 +209,7 @@ void QQuickSliderPrivate::handleMove(const QPointF &point)
|
|||
void QQuickSliderPrivate::handleRelease(const QPointF &point)
|
||||
{
|
||||
Q_Q(QQuickSlider);
|
||||
QQuickControlPrivate::handleRelease(point);
|
||||
pressPoint = QPointF();
|
||||
const qreal oldPos = position;
|
||||
qreal pos = positionAt(point);
|
||||
|
@ -227,6 +230,7 @@ void QQuickSliderPrivate::handleRelease(const QPointF &point)
|
|||
void QQuickSliderPrivate::handleUngrab()
|
||||
{
|
||||
Q_Q(QQuickSlider);
|
||||
QQuickControlPrivate::handleUngrab();
|
||||
pressPoint = QPointF();
|
||||
q->setPressed(false);
|
||||
}
|
||||
|
@ -614,92 +618,57 @@ void QQuickSlider::mousePressEvent(QMouseEvent *event)
|
|||
{
|
||||
Q_D(QQuickSlider);
|
||||
QQuickControl::mousePressEvent(event);
|
||||
d->handlePress(event->localPos());
|
||||
d->handleMove(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickSlider::mouseMoveEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickSlider);
|
||||
QQuickControl::mouseMoveEvent(event);
|
||||
if (!keepMouseGrab()) {
|
||||
if (d->orientation == Qt::Horizontal)
|
||||
setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->localPos().x() - d->pressPoint.x(), Qt::XAxis, event));
|
||||
else
|
||||
setKeepMouseGrab(QQuickWindowPrivate::dragOverThreshold(event->localPos().y() - d->pressPoint.y(), Qt::YAxis, event));
|
||||
}
|
||||
d->handleMove(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickSlider::mouseReleaseEvent(QMouseEvent *event)
|
||||
{
|
||||
Q_D(QQuickSlider);
|
||||
QQuickControl::mouseReleaseEvent(event);
|
||||
d->handleRelease(event->localPos());
|
||||
}
|
||||
|
||||
void QQuickSlider::mouseUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickSlider);
|
||||
QQuickControl::mouseUngrabEvent();
|
||||
d->handleUngrab();
|
||||
QQuickControl::mouseMoveEvent(event);
|
||||
}
|
||||
|
||||
void QQuickSlider::touchEvent(QTouchEvent *event)
|
||||
{
|
||||
Q_D(QQuickSlider);
|
||||
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)
|
||||
if (!d->acceptTouch(point))
|
||||
continue;
|
||||
|
||||
if (!keepTouchGrab()) {
|
||||
if (d->orientation == Qt::Horizontal)
|
||||
setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point));
|
||||
else
|
||||
setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - d->pressPoint.y(), Qt::YAxis, &point));
|
||||
switch (point.state()) {
|
||||
case Qt::TouchPointPressed:
|
||||
d->handlePress(point.pos());
|
||||
break;
|
||||
case Qt::TouchPointMoved:
|
||||
if (!keepTouchGrab()) {
|
||||
if (d->orientation == Qt::Horizontal)
|
||||
setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().x() - d->pressPoint.x(), Qt::XAxis, &point));
|
||||
else
|
||||
setKeepTouchGrab(QQuickWindowPrivate::dragOverThreshold(point.pos().y() - d->pressPoint.y(), Qt::YAxis, &point));
|
||||
}
|
||||
if (keepTouchGrab())
|
||||
d->handleMove(point.pos());
|
||||
break;
|
||||
case Qt::TouchPointReleased:
|
||||
d->handleRelease(point.pos());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
if (keepTouchGrab())
|
||||
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:
|
||||
QQuickControl::touchEvent(event);
|
||||
break;
|
||||
}
|
||||
|
||||
QQuickControl::touchEvent(event);
|
||||
}
|
||||
|
||||
void QQuickSlider::touchUngrabEvent()
|
||||
{
|
||||
Q_D(QQuickSlider);
|
||||
QQuickControl::touchUngrabEvent();
|
||||
d->handleUngrab();
|
||||
}
|
||||
|
||||
#if QT_CONFIG(wheelevent)
|
||||
|
|
|
@ -134,10 +134,7 @@ protected:
|
|||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseUngrabEvent() override;
|
||||
void touchEvent(QTouchEvent *event) override;
|
||||
void touchUngrabEvent() override;
|
||||
#if QT_CONFIG(wheelevent)
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
#endif
|
||||
|
|
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -132,13 +132,7 @@ protected:
|
|||
void hoverLeaveEvent(QHoverEvent *event) override;
|
||||
void keyPressEvent(QKeyEvent *event) override;
|
||||
void keyReleaseEvent(QKeyEvent *event) override;
|
||||
void mousePressEvent(QMouseEvent *event) override;
|
||||
void mouseMoveEvent(QMouseEvent *event) override;
|
||||
void mouseReleaseEvent(QMouseEvent *event) override;
|
||||
void mouseUngrabEvent() override;
|
||||
void timerEvent(QTimerEvent *event) override;
|
||||
void touchEvent(QTouchEvent *event) override;
|
||||
void touchUngrabEvent() override;
|
||||
#if QT_CONFIG(wheelevent)
|
||||
void wheelEvent(QWheelEvent *event) override;
|
||||
#endif
|
||||
|
|
|
@ -221,7 +221,6 @@ void tst_focus::policy()
|
|||
QCOMPARE(control->focusPolicy(), Qt::ClickFocus);
|
||||
QTest::touchEvent(window.data(), device.data()).press(0, QPoint(control->width() / 2, control->height() / 2));
|
||||
QTest::touchEvent(window.data(), device.data()).release(0, QPoint(control->width() / 2, control->height() / 2));
|
||||
QEXPECT_FAIL("Control", "TODO: Control::touchEvent should set the touchId", Continue);
|
||||
QVERIFY(control->hasActiveFocus());
|
||||
QVERIFY(!control->hasVisualFocus());
|
||||
|
||||
|
|
Loading…
Reference in New Issue