diff options
author | J-P Nurmi <jpnurmi@qt.io> | 2017-11-02 18:55:26 +0100 |
---|---|---|
committer | J-P Nurmi <jpnurmi@qt.io> | 2017-11-03 10:37:26 +0000 |
commit | a2d1f1ad14ca5e1123abe07329a28500ce71678d (patch) | |
tree | 8113e4f29c92f1d00c737a89d22f35c0f1966c3c /src | |
parent | fbb5e0310687f8c628dc6e82a5f8b80fcd972f60 (diff) |
QQuickTextField: retain selection on right mouse button click
QQuickTextField wants to emit pressed(), released(), and pressAndHold()
signals not only on left, but on all mouse button clicks. Therefore it
explicitly sets accepted mouse buttons to all. However, the base class,
QQuickTextInput, has only been prepared to handle left (selection) and
middle (paste) mouse buttons. Don't pass right mouse button -only
events to the base class to avoid it clearing selection on right click.
Task-number: QTBUG-64048
Change-Id: I015820c78995cc8dd7cbeb16fca0f9b991040bad
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Diffstat (limited to 'src')
-rw-r--r-- | src/quicktemplates2/qquicktextfield.cpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/quicktemplates2/qquicktextfield.cpp b/src/quicktemplates2/qquicktextfield.cpp index f0008a59..397e666e 100644 --- a/src/quicktemplates2/qquicktextfield.cpp +++ b/src/quicktemplates2/qquicktextfield.cpp @@ -547,7 +547,8 @@ void QQuickTextField::mousePressEvent(QMouseEvent *event) QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent); d->pressHandler.clearDelayedMouseEvent(); } - QQuickTextInput::mousePressEvent(event); + if (event->buttons() != Qt::RightButton) + QQuickTextInput::mousePressEvent(event); } } @@ -560,7 +561,8 @@ void QQuickTextField::mouseMoveEvent(QMouseEvent *event) QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent); d->pressHandler.clearDelayedMouseEvent(); } - QQuickTextInput::mouseMoveEvent(event); + if (event->buttons() != Qt::RightButton) + QQuickTextInput::mouseMoveEvent(event); } } @@ -573,7 +575,8 @@ void QQuickTextField::mouseReleaseEvent(QMouseEvent *event) QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent); d->pressHandler.clearDelayedMouseEvent(); } - QQuickTextInput::mouseReleaseEvent(event); + if (event->buttons() != Qt::RightButton) + QQuickTextInput::mouseReleaseEvent(event); } } @@ -584,7 +587,8 @@ void QQuickTextField::mouseDoubleClickEvent(QMouseEvent *event) QQuickTextInput::mousePressEvent(d->pressHandler.delayedMousePressEvent); d->pressHandler.clearDelayedMouseEvent(); } - QQuickTextInput::mouseDoubleClickEvent(event); + if (event->buttons() != Qt::RightButton) + QQuickTextInput::mouseDoubleClickEvent(event); } void QQuickTextField::timerEvent(QTimerEvent *event) |