Properly deprecate Qt::MidButton in favor of Qt::MiddleButton
MidButton had its // ### Qt 5: remove me upgraded to Qt 6 at 5.0; but it dates back to 4.7.0 Replace the many remaining uses of MidButton with MiddleButton in the process. Pick-to: 5.15 Change-Id: Idc1b1b1816673dfdb344d703d101febc823a76ff Reviewed-by: Lars Knoll <lars.knoll@qt.io>
This commit is contained in:
parent
4b1ffab8ad
commit
16e546e32f
@ -81,8 +81,10 @@ namespace Qt {
|
||||
NoButton = 0x00000000,
|
||||
LeftButton = 0x00000001,
|
||||
RightButton = 0x00000002,
|
||||
MidButton = 0x00000004, // ### Qt 6: remove me
|
||||
MiddleButton = MidButton,
|
||||
MiddleButton = 0x00000004,
|
||||
#if QT_DEPRECATED_SINCE(5, 15) // commented as such since 4.7.0
|
||||
MidButton Q_DECL_ENUMERATOR_DEPRECATED_X("MidButton is deprecated. Use MiddleButton instead") = MiddleButton,
|
||||
#endif
|
||||
BackButton = 0x00000008,
|
||||
XButton1 = BackButton,
|
||||
ExtraButton1 = XButton1,
|
||||
|
@ -323,8 +323,8 @@
|
||||
to the left button. (The left button may be the right button on
|
||||
left-handed mice.)
|
||||
\value RightButton The right button.
|
||||
\value MidButton The middle button.
|
||||
\value MiddleButton The middle button.
|
||||
\omitvalue MidButton
|
||||
|
||||
\value BackButton The 'Back' button. (Typically present on
|
||||
the 'thumb' side of a mouse with extra buttons. This is NOT
|
||||
|
@ -735,7 +735,7 @@ Qt::MouseEventFlags QMouseEvent::flags() const
|
||||
|
||||
Returns the button state when the event was generated. The button
|
||||
state is a combination of Qt::LeftButton, Qt::RightButton,
|
||||
Qt::MidButton using the OR operator. For mouse move events,
|
||||
Qt::MiddleButton using the OR operator. For mouse move events,
|
||||
this is all buttons that are pressed down. For mouse press and
|
||||
double click events this includes the button that caused the
|
||||
event. For mouse release events this excludes the button that
|
||||
|
@ -271,7 +271,7 @@ void QCocoaSystemTrayIcon::statusItemClicked()
|
||||
activationReason = QPlatformSystemTrayIcon::DoubleClick;
|
||||
} else {
|
||||
auto mouseButton = cocoaButton2QtButton(mouseEvent);
|
||||
if (mouseButton == Qt::MidButton)
|
||||
if (mouseButton == Qt::MiddleButton)
|
||||
activationReason = QPlatformSystemTrayIcon::MiddleClick;
|
||||
else if (mouseButton == Qt::RightButton)
|
||||
activationReason = QPlatformSystemTrayIcon::Context;
|
||||
|
@ -136,7 +136,7 @@ Qt::MouseButton QDirectFbConvenience::mouseButton(DFBInputDeviceButtonIdentifier
|
||||
case DIBI_RIGHT: // value is 0x01
|
||||
return Qt::RightButton;
|
||||
case DIBI_MIDDLE: // value is 0x02
|
||||
return Qt::MidButton;
|
||||
return Qt::MiddleButton;
|
||||
case 0x03:
|
||||
return Qt::BackButton;
|
||||
case 0x04:
|
||||
@ -198,7 +198,7 @@ Qt::MouseButtons QDirectFbConvenience::mouseButtons(DFBInputDeviceButtonMask mas
|
||||
buttons |= Qt::LeftButton;
|
||||
}
|
||||
if (mask & DIBM_MIDDLE) {
|
||||
buttons |= Qt::MidButton;
|
||||
buttons |= Qt::MiddleButton;
|
||||
}
|
||||
if (mask & DIBM_RIGHT) {
|
||||
buttons |= Qt::RightButton;
|
||||
|
@ -425,7 +425,7 @@ bool QRfbPointerEvent::read(QTcpSocket *s)
|
||||
if (buttonMask & 1)
|
||||
buttons |= Qt::LeftButton;
|
||||
if (buttonMask & 2)
|
||||
buttons |= Qt::MidButton;
|
||||
buttons |= Qt::MiddleButton;
|
||||
if (buttonMask & 4)
|
||||
buttons |= Qt::RightButton;
|
||||
|
||||
|
@ -143,7 +143,7 @@ Qt::MouseButtons QWindowsMouseHandler::queryMouseButtons()
|
||||
if (GetAsyncKeyState(VK_RBUTTON) < 0)
|
||||
result |= mouseSwapped ? Qt::LeftButton : Qt::RightButton;
|
||||
if (GetAsyncKeyState(VK_MBUTTON) < 0)
|
||||
result |= Qt::MidButton;
|
||||
result |= Qt::MiddleButton;
|
||||
if (GetAsyncKeyState(VK_XBUTTON1) < 0)
|
||||
result |= Qt::XButton1;
|
||||
if (GetAsyncKeyState(VK_XBUTTON2) < 0)
|
||||
@ -187,11 +187,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
|
||||
case WM_LBUTTONDBLCLK: // Qt QPA does not handle double clicks, send as press
|
||||
return {QEvent::MouseButtonPress, Qt::LeftButton};
|
||||
case WM_MBUTTONDOWN:
|
||||
return {QEvent::MouseButtonPress, Qt::MidButton};
|
||||
return {QEvent::MouseButtonPress, Qt::MiddleButton};
|
||||
case WM_MBUTTONUP:
|
||||
return {QEvent::MouseButtonRelease, Qt::MidButton};
|
||||
return {QEvent::MouseButtonRelease, Qt::MiddleButton};
|
||||
case WM_MBUTTONDBLCLK:
|
||||
return {QEvent::MouseButtonPress, Qt::MidButton};
|
||||
return {QEvent::MouseButtonPress, Qt::MiddleButton};
|
||||
case WM_RBUTTONDOWN:
|
||||
return {QEvent::MouseButtonPress, Qt::RightButton};
|
||||
case WM_RBUTTONUP:
|
||||
@ -213,11 +213,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::LeftButton};
|
||||
case WM_NCMBUTTONDOWN:
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
|
||||
case WM_NCMBUTTONUP:
|
||||
return {QEvent::NonClientAreaMouseButtonRelease, Qt::MidButton};
|
||||
return {QEvent::NonClientAreaMouseButtonRelease, Qt::MiddleButton};
|
||||
case WM_NCMBUTTONDBLCLK:
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
|
||||
case WM_NCRBUTTONDOWN:
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::RightButton};
|
||||
case WM_NCRBUTTONUP:
|
||||
|
@ -197,11 +197,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
|
||||
case WM_LBUTTONDBLCLK: // Qt QPA does not handle double clicks, send as press
|
||||
return {QEvent::MouseButtonPress, Qt::LeftButton};
|
||||
case WM_MBUTTONDOWN:
|
||||
return {QEvent::MouseButtonPress, Qt::MidButton};
|
||||
return {QEvent::MouseButtonPress, Qt::MiddleButton};
|
||||
case WM_MBUTTONUP:
|
||||
return {QEvent::MouseButtonRelease, Qt::MidButton};
|
||||
return {QEvent::MouseButtonRelease, Qt::MiddleButton};
|
||||
case WM_MBUTTONDBLCLK:
|
||||
return {QEvent::MouseButtonPress, Qt::MidButton};
|
||||
return {QEvent::MouseButtonPress, Qt::MiddleButton};
|
||||
case WM_RBUTTONDOWN:
|
||||
return {QEvent::MouseButtonPress, Qt::RightButton};
|
||||
case WM_RBUTTONUP:
|
||||
@ -223,11 +223,11 @@ static inline MouseEvent eventFromMsg(const MSG &msg)
|
||||
case WM_NCLBUTTONDBLCLK:
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::LeftButton};
|
||||
case WM_NCMBUTTONDOWN:
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
|
||||
case WM_NCMBUTTONUP:
|
||||
return {QEvent::NonClientAreaMouseButtonRelease, Qt::MidButton};
|
||||
return {QEvent::NonClientAreaMouseButtonRelease, Qt::MiddleButton};
|
||||
case WM_NCMBUTTONDBLCLK:
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::MidButton};
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::MiddleButton};
|
||||
case WM_NCRBUTTONDOWN:
|
||||
return {QEvent::NonClientAreaMouseButtonPress, Qt::RightButton};
|
||||
case WM_NCRBUTTONUP:
|
||||
@ -265,7 +265,7 @@ static Qt::MouseButtons queryMouseButtons()
|
||||
if (GetAsyncKeyState(VK_RBUTTON) < 0)
|
||||
result |= mouseSwapped ? Qt::LeftButton : Qt::RightButton;
|
||||
if (GetAsyncKeyState(VK_MBUTTON) < 0)
|
||||
result |= Qt::MidButton;
|
||||
result |= Qt::MiddleButton;
|
||||
if (GetAsyncKeyState(VK_XBUTTON1) < 0)
|
||||
result |= Qt::XButton1;
|
||||
if (GetAsyncKeyState(VK_XBUTTON2) < 0)
|
||||
|
@ -459,7 +459,7 @@ static Qt::MouseButtons translateMouseButtons(int s)
|
||||
if (s & XCB_BUTTON_MASK_1)
|
||||
ret |= Qt::LeftButton;
|
||||
if (s & XCB_BUTTON_MASK_2)
|
||||
ret |= Qt::MidButton;
|
||||
ret |= Qt::MiddleButton;
|
||||
if (s & XCB_BUTTON_MASK_3)
|
||||
ret |= Qt::RightButton;
|
||||
return ret;
|
||||
@ -475,7 +475,7 @@ Qt::MouseButton QXcbConnection::translateMouseButton(xcb_button_t s)
|
||||
{
|
||||
switch (s) {
|
||||
case 1: return Qt::LeftButton;
|
||||
case 2: return Qt::MidButton;
|
||||
case 2: return Qt::MiddleButton;
|
||||
case 3: return Qt::RightButton;
|
||||
// Button values 4-7 were already handled as Wheel events, and won't occur here.
|
||||
case 8: return Qt::BackButton; // Also known as Qt::ExtraButton1
|
||||
|
@ -2611,7 +2611,7 @@ int QMacStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget *w
|
||||
ret = true;
|
||||
break;
|
||||
case SH_Slider_AbsoluteSetButtons:
|
||||
ret = Qt::LeftButton|Qt::MidButton;
|
||||
ret = Qt::LeftButton|Qt::MiddleButton;
|
||||
break;
|
||||
case SH_Slider_PageSetButtons:
|
||||
ret = 0;
|
||||
|
@ -5054,7 +5054,7 @@ int QCommonStyle::styleHint(StyleHint sh, const QStyleOption *opt, const QWidget
|
||||
ret = false;
|
||||
break;
|
||||
case SH_Slider_AbsoluteSetButtons:
|
||||
ret = Qt::MidButton;
|
||||
ret = Qt::MiddleButton;
|
||||
break;
|
||||
case SH_Slider_PageSetButtons:
|
||||
ret = Qt::LeftButton;
|
||||
|
@ -137,7 +137,7 @@ void QSystemTrayIconSys::mousePressEvent(QMouseEvent *ev)
|
||||
emit q->activated(QSystemTrayIcon::Trigger);
|
||||
else if (ev->button() == Qt::RightButton)
|
||||
emit q->activated(QSystemTrayIcon::Context);
|
||||
else if (ev->button() == Qt::MidButton)
|
||||
else if (ev->button() == Qt::MiddleButton)
|
||||
emit q->activated(QSystemTrayIcon::MiddleClick);
|
||||
}
|
||||
|
||||
|
@ -1615,7 +1615,7 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e)
|
||||
if (QGuiApplication::clipboard()->supportsSelection()) {
|
||||
if (e->button() == Qt::LeftButton) {
|
||||
d->control->copy(QClipboard::Selection);
|
||||
} else if (!d->control->isReadOnly() && e->button() == Qt::MidButton) {
|
||||
} else if (!d->control->isReadOnly() && e->button() == Qt::MiddleButton) {
|
||||
deselect();
|
||||
d->control->paste(QClipboard::Selection);
|
||||
}
|
||||
|
@ -582,7 +582,7 @@ private:
|
||||
*/
|
||||
void QMdiAreaTabBar::mousePressEvent(QMouseEvent *event)
|
||||
{
|
||||
if (event->button() != Qt::MidButton) {
|
||||
if (event->button() != Qt::MiddleButton) {
|
||||
QTabBar::mousePressEvent(event);
|
||||
return;
|
||||
}
|
||||
|
@ -557,7 +557,7 @@ void QScrollBar::mousePressEvent(QMouseEvent *e)
|
||||
|
||||
if (d->maximum == d->minimum // no range
|
||||
|| (e->buttons() & (~e->button())) // another button was clicked before
|
||||
|| !(e->button() == Qt::LeftButton || (midButtonAbsPos && e->button() == Qt::MidButton)))
|
||||
|| !(e->button() == Qt::LeftButton || (midButtonAbsPos && e->button() == Qt::MiddleButton)))
|
||||
return;
|
||||
|
||||
d->pressedControl = style()->hitTestComplexControl(QStyle::CC_ScrollBar, &opt, e->position().toPoint(), this);
|
||||
@ -576,7 +576,7 @@ void QScrollBar::mousePressEvent(QMouseEvent *e)
|
||||
|
||||
if ((d->pressedControl == QStyle::SC_ScrollBarAddPage
|
||||
|| d->pressedControl == QStyle::SC_ScrollBarSubPage)
|
||||
&& ((midButtonAbsPos && e->button() == Qt::MidButton)
|
||||
&& ((midButtonAbsPos && e->button() == Qt::MiddleButton)
|
||||
|| (style()->styleHint(QStyle::SH_ScrollBar_LeftClickAbsolutePosition, &opt, this)
|
||||
&& e->button() == Qt::LeftButton))) {
|
||||
int sliderLength = HORIZONTAL ? sr.width() : sr.height();
|
||||
@ -632,7 +632,7 @@ void QScrollBar::mouseMoveEvent(QMouseEvent *e)
|
||||
QStyleOptionSlider opt;
|
||||
initStyleOption(&opt);
|
||||
if (!(e->buttons() & Qt::LeftButton
|
||||
|| ((e->buttons() & Qt::MidButton)
|
||||
|| ((e->buttons() & Qt::MiddleButton)
|
||||
&& style()->styleHint(QStyle::SH_ScrollBar_MiddleClickAbsolutePosition, &opt, this))))
|
||||
return;
|
||||
|
||||
|
@ -1794,7 +1794,7 @@ void QWidgetTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton but
|
||||
#ifndef QT_NO_CLIPBOARD
|
||||
setClipboardSelection();
|
||||
selectionChanged(true);
|
||||
} else if (button == Qt::MidButton
|
||||
} else if (button == Qt::MiddleButton
|
||||
&& (interactionFlags & Qt::TextEditable)
|
||||
&& QGuiApplication::clipboard()->supportsSelection()) {
|
||||
setCursorPosition(pos);
|
||||
|
@ -49,7 +49,7 @@ void tst_QFlags::testFlag() const
|
||||
Qt::MouseButtons btn = Qt::LeftButton | Qt::RightButton;
|
||||
|
||||
QVERIFY(btn.testFlag(Qt::LeftButton));
|
||||
QVERIFY(!btn.testFlag(Qt::MidButton));
|
||||
QVERIFY(!btn.testFlag(Qt::MiddleButton));
|
||||
|
||||
btn = { };
|
||||
QVERIFY(!btn.testFlag(Qt::LeftButton));
|
||||
@ -276,11 +276,11 @@ void tst_QFlags::testSetFlags()
|
||||
|
||||
btn.setFlag(Qt::LeftButton);
|
||||
QVERIFY(btn.testFlag(Qt::LeftButton));
|
||||
QVERIFY(!btn.testFlag(Qt::MidButton));
|
||||
QVERIFY(!btn.testFlag(Qt::MiddleButton));
|
||||
|
||||
btn.setFlag(Qt::LeftButton, false);
|
||||
QVERIFY(!btn.testFlag(Qt::LeftButton));
|
||||
QVERIFY(!btn.testFlag(Qt::MidButton));
|
||||
QVERIFY(!btn.testFlag(Qt::MiddleButton));
|
||||
|
||||
MyStrictFlags flags;
|
||||
flags.setFlag(MyStrictEnum::StrictOne);
|
||||
|
@ -152,11 +152,11 @@ void tst_QMouseEvent::checkMousePressEvent_data()
|
||||
QTest::newRow("rightButton-controlkey") << int(Qt::RightButton) << int(Qt::ControlModifier);
|
||||
QTest::newRow("rightButton-altkey") << int(Qt::RightButton) << int(Qt::AltModifier);
|
||||
QTest::newRow("rightButton-metakey") << int(Qt::RightButton) << int(Qt::MetaModifier);
|
||||
QTest::newRow("midButton-nokey") << int(Qt::MidButton) << int(Qt::NoButton);
|
||||
QTest::newRow("midButton-shiftkey") << int(Qt::MidButton) << int(Qt::ShiftModifier);
|
||||
QTest::newRow("midButton-controlkey") << int(Qt::MidButton) << int(Qt::ControlModifier);
|
||||
QTest::newRow("midButton-altkey") << int(Qt::MidButton) << int(Qt::AltModifier);
|
||||
QTest::newRow("midButton-metakey") << int(Qt::MidButton) << int(Qt::MetaModifier);
|
||||
QTest::newRow("middleButton-nokey") << int(Qt::MiddleButton) << int(Qt::NoButton);
|
||||
QTest::newRow("middleButton-shiftkey") << int(Qt::MiddleButton) << int(Qt::ShiftModifier);
|
||||
QTest::newRow("middleButton-controlkey") << int(Qt::MiddleButton) << int(Qt::ControlModifier);
|
||||
QTest::newRow("middleButton-altkey") << int(Qt::MiddleButton) << int(Qt::AltModifier);
|
||||
QTest::newRow("middleButton-metakey") << int(Qt::MiddleButton) << int(Qt::MetaModifier);
|
||||
}
|
||||
|
||||
void tst_QMouseEvent::checkMousePressEvent()
|
||||
@ -193,11 +193,11 @@ void tst_QMouseEvent::checkMouseReleaseEvent_data()
|
||||
QTest::newRow("rightButton-controlkey") << int(Qt::RightButton) << int(Qt::ControlModifier);
|
||||
QTest::newRow("rightButton-altkey") << int(Qt::RightButton) << int(Qt::AltModifier);
|
||||
QTest::newRow("rightButton-metakey") << int(Qt::RightButton) << int(Qt::MetaModifier);
|
||||
QTest::newRow("midButton-nokey") << int(Qt::MidButton) << int(Qt::NoButton);
|
||||
QTest::newRow("midButton-shiftkey") << int(Qt::MidButton) << int(Qt::ShiftModifier);
|
||||
QTest::newRow("midButton-controlkey") << int(Qt::MidButton) << int(Qt::ControlModifier);
|
||||
QTest::newRow("midButton-altkey") << int(Qt::MidButton) << int(Qt::AltModifier);
|
||||
QTest::newRow("midButton-metakey") << int(Qt::MidButton) << int(Qt::MetaModifier);
|
||||
QTest::newRow("middleButton-nokey") << int(Qt::MiddleButton) << int(Qt::NoButton);
|
||||
QTest::newRow("middleButton-shiftkey") << int(Qt::MiddleButton) << int(Qt::ShiftModifier);
|
||||
QTest::newRow("middleButton-controlkey") << int(Qt::MiddleButton) << int(Qt::ControlModifier);
|
||||
QTest::newRow("middleButton-altkey") << int(Qt::MiddleButton) << int(Qt::AltModifier);
|
||||
QTest::newRow("middleButton-metakey") << int(Qt::MiddleButton) << int(Qt::MetaModifier);
|
||||
}
|
||||
|
||||
void tst_QMouseEvent::checkMouseReleaseEvent()
|
||||
|
@ -130,8 +130,8 @@ static QString getButtonAsString(const QNativeMouseButtonEvent *e)
|
||||
case Qt::RightButton:
|
||||
return "button = RightButton";
|
||||
break;
|
||||
case Qt::MidButton:
|
||||
return "button = MidButton";
|
||||
case Qt::MiddleButton:
|
||||
return "button = MiddleButton";
|
||||
break;
|
||||
default:
|
||||
return "button = Other";
|
||||
@ -292,7 +292,7 @@ QTextStream &operator>>(QTextStream &s, QNativeMouseButtonEvent *e)
|
||||
e->button = Qt::RightButton;
|
||||
break;
|
||||
case 3:
|
||||
e->button = Qt::MidButton;
|
||||
e->button = Qt::MiddleButton;
|
||||
break;
|
||||
default:
|
||||
e->button = Qt::NoButton;
|
||||
@ -319,7 +319,7 @@ QTextStream &operator>>(QTextStream &s, QNativeMouseDragEvent *e)
|
||||
e->button = Qt::RightButton;
|
||||
break;
|
||||
case 3:
|
||||
e->button = Qt::MidButton;
|
||||
e->button = Qt::MiddleButton;
|
||||
break;
|
||||
default:
|
||||
e->button = Qt::NoButton;
|
||||
|
Loading…
x
Reference in New Issue
Block a user