Replace Qt's MidButton with MiddleButton

The latter has been the preferred name since Qt 4.7.0.
Added a comment on where the old name is exposed to QML that it's only
for backwards compatibility.

Pick-to: 5.15
Change-Id: I2c5088d597dd7327cc5899d06afb180d0ec2893e
Reviewed-by: Shawn Rutledge <shawn.rutledge@qt.io>
This commit is contained in:
Edward Welbourne 2020-07-21 12:09:26 +02:00
parent b4d36a05be
commit 3debb37250
5 changed files with 5 additions and 5 deletions

View File

@ -81,7 +81,7 @@ Rectangle {
buttonID = 'LeftButton'
else if (mouse.button == Qt.RightButton)
buttonID = 'RightButton'
else if (mouse.button == Qt.MidButton)
else if (mouse.button == Qt.MiddleButton)
buttonID = 'MiddleButton'
else if (mouse.button == Qt.BackButton)
buttonID = 'BackButton'

View File

@ -51,7 +51,7 @@ Module {
"NoButton": 0,
"LeftButton": 1,
"RightButton": 2,
"MidButton": 4,
"MidButton": 4, // For backwards compatibility
"MiddleButton": 4,
"BackButton": 8,
"XButton1": 8,

View File

@ -1192,7 +1192,7 @@ void QQuickTextControlPrivate::mouseReleaseEvent(QMouseEvent *e, const QPointF &
#if QT_CONFIG(clipboard)
setClipboardSelection();
selectionChanged(true);
} else if (e->button() == Qt::MidButton
} else if (e->button() == Qt::MiddleButton
&& (interactionFlags & Qt::TextEditable)
&& QGuiApplication::clipboard()->supportsSelection()) {
setCursorPosition(pos);

View File

@ -1628,7 +1628,7 @@ void QQuickTextInput::mouseReleaseEvent(QMouseEvent *event)
if (QGuiApplication::clipboard()->supportsSelection()) {
if (event->button() == Qt::LeftButton) {
d->copy(QClipboard::Selection);
} else if (!d->m_readOnly && event->button() == Qt::MidButton) {
} else if (!d->m_readOnly && event->button() == Qt::MiddleButton) {
d->deselect();
d->insert(QGuiApplication::clipboard()->text(QClipboard::Selection));
}

View File

@ -126,7 +126,7 @@ Rectangle {
}
Image {
source: "resources/mouse_middle.png"
visible: buttons & Qt.MidButton
visible: buttons & Qt.MiddleButton
}
Image {
source: "resources/mouse_right.png"