From b10210d4b3f52f7bda663cb7c855dc65d8adb3e8 Mon Sep 17 00:00:00 2001 From: Ivailo Monev Date: Tue, 7 May 2019 15:37:59 +0000 Subject: [PATCH] namespace cleanup Signed-off-by: Ivailo Monev --- src/core/global/qnamespace.h | 31 ++++++----------------- src/core/global/qnamespace.qdoc | 1 - src/designer/components/formeditor/formwindow.cpp | 6 ++--- src/gui/kernel/qapplication_x11.cpp | 4 +-- src/gui/kernel/qevent.cpp | 4 +-- src/gui/styles/qcommonstyle.cpp | 2 +- src/gui/text/qtextcontrol.cpp | 2 +- src/gui/util/qsystemtrayicon_x11.cpp | 2 +- src/gui/widgets/qlinecontrol.cpp | 2 +- src/gui/widgets/qlineedit.cpp | 2 +- src/gui/widgets/qmdiarea.cpp | 2 +- src/gui/widgets/qscrollbar.cpp | 6 ++--- 12 files changed, 24 insertions(+), 40 deletions(-) diff --git a/src/core/global/qnamespace.h b/src/core/global/qnamespace.h index 776b08bbe..24629c537 100644 --- a/src/core/global/qnamespace.h +++ b/src/core/global/qnamespace.h @@ -144,8 +144,7 @@ public: NoButton = 0x00000000, LeftButton = 0x00000001, RightButton = 0x00000002, - MidButton = 0x00000004, // ### Qt 5: remove me - MiddleButton = MidButton, + MiddleButton = 0x00000004, XButton1 = 0x00000008, XButton2 = 0x00000010, MouseButtonMask = 0x000000ff @@ -157,7 +156,6 @@ public: Horizontal = 0x1, Vertical = 0x2 }; - Q_DECLARE_FLAGS(Orientations, Orientation) enum FocusPolicy { @@ -182,7 +180,6 @@ public: // Text formatting flags for QPainter::drawText and QLabel. // The following two enums can be combined to one integer which // is passed as 'flags' to drawText and qt_format_text. - enum AlignmentFlag { AlignLeft = 0x0001, AlignLeading = AlignLeft, @@ -200,7 +197,6 @@ public: AlignCenter = AlignVCenter | AlignHCenter }; - Q_DECLARE_FLAGS(Alignment, AlignmentFlag) enum TextFlag { @@ -218,7 +214,6 @@ public: TextForceRightToLeft = 0x40000, TextLongestVariant = 0x80000, TextBypassShaping = 0x100000 - }; enum TextElideMode { @@ -267,7 +262,6 @@ public: WindowFullScreen = 0x00000004, WindowActive = 0x00000008 }; - Q_DECLARE_FLAGS(WindowStates, WindowState) enum WidgetAttribute { @@ -404,10 +398,8 @@ public: AA_AttributeCount }; - // Image conversion flags. The unusual ordering is caused by // compatibility and default requirements. - enum ImageConversionFlag { ColorMode_Mask = 0x00000003, AutoColor = 0x00000000, @@ -442,7 +434,6 @@ public: OpaqueMode }; - enum Key { Key_Escape = 0x01000000, // misc keys Key_Tab = 0x01000001, @@ -916,7 +907,7 @@ public: RightArrow }; - enum PenStyle { // pen style + enum PenStyle { NoPen, SolidLine, DashLine, @@ -929,14 +920,16 @@ public: #endif }; - enum PenCapStyle { // line endcap style + // line endcap style + enum PenCapStyle { FlatCap = 0x00, SquareCap = 0x10, RoundCap = 0x20, MPenCapStyle = 0x30 }; - enum PenJoinStyle { // line join style + // line join style + enum PenJoinStyle { MiterJoin = 0x00, BevelJoin = 0x40, RoundJoin = 0x80, @@ -944,7 +937,7 @@ public: MPenJoinStyle = 0x1c0 }; - enum BrushStyle { // brush style + enum BrushStyle { NoBrush, SolidPattern, Dense1Pattern, @@ -971,7 +964,6 @@ public: RelativeSize }; - enum UIEffect { UI_General, UI_AnimateMenu, @@ -1042,7 +1034,6 @@ public: enum DockWidgetAreaSizes { NDockWidgetAreas = 4 }; - Q_DECLARE_FLAGS(DockWidgetAreas, DockWidgetArea) enum ToolBarArea { @@ -1059,10 +1050,8 @@ public: enum ToolBarAreaSizes { NToolBarAreas = 4 }; - Q_DECLARE_FLAGS(ToolBarAreas, ToolBarArea) - enum DateFormat { TextDate, // default Qt ISODate, // ISO 8601 @@ -1097,7 +1086,6 @@ public: ScrollBarAlwaysOn }; - enum CaseSensitivity { CaseInsensitive, CaseSensitive @@ -1204,8 +1192,6 @@ public: AnchorBottom }; - - enum DropAction { CopyAction = 0x1, MoveAction = 0x2, @@ -1428,13 +1414,13 @@ public: Printer = 4, CustomRaster = 5 }; + enum RelayoutType { RelayoutNormal, RelayoutDragging, RelayoutDropped }; - enum Callback { ConnectCallback, DisconnectCallback, @@ -1469,7 +1455,6 @@ public: static bool callFunction(InternalFunction func, void **); }; - QT_END_NAMESPACE QT_END_HEADER diff --git a/src/core/global/qnamespace.qdoc b/src/core/global/qnamespace.qdoc index 4b3097dd8..f193365d2 100644 --- a/src/core/global/qnamespace.qdoc +++ b/src/core/global/qnamespace.qdoc @@ -153,7 +153,6 @@ 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. \value XButton1 The first X button. \value XButton2 The second X button. diff --git a/src/designer/components/formeditor/formwindow.cpp b/src/designer/components/formeditor/formwindow.cpp index f80af61dc..cd028a821 100644 --- a/src/designer/components/formeditor/formwindow.cpp +++ b/src/designer/components/formeditor/formwindow.cpp @@ -595,7 +595,7 @@ bool FormWindow::handleMousePressEvent(QWidget * widget, QWidget *managedWidget, core()->formWindowManager()->setActiveFormWindow(this); const Qt::MouseButtons buttons = e->buttons(); - if (buttons != Qt::LeftButton && buttons != Qt::MidButton) + if (buttons != Qt::LeftButton && buttons != Qt::MiddleButton) return true; m_startPos = mapFromGlobal(e->globalPos()); @@ -603,7 +603,7 @@ bool FormWindow::handleMousePressEvent(QWidget * widget, QWidget *managedWidget, if (debugFormWindow) qDebug() << "handleMousePressEvent:" << widget << ',' << managedWidget; - if (buttons == Qt::MidButton || isMainContainer(managedWidget) == true) { // press was on the formwindow + if (buttons == Qt::MiddleButton || isMainContainer(managedWidget) == true) { // press was on the formwindow clearObjectInspectorSelection(m_core); // We might have a toolbar or non-widget selected in the object inspector. clearSelection(false); @@ -782,7 +782,7 @@ bool FormWindow::handleMouseReleaseEvent(QWidget *w, QWidget *mw, QMouseEvent *e * MousePressEvent. */ switch (e->button()) { case Qt::LeftButton: - case Qt::MidButton: + case Qt::MiddleButton: case Qt::RightButton: emitSelectionChanged(); break; diff --git a/src/gui/kernel/qapplication_x11.cpp b/src/gui/kernel/qapplication_x11.cpp index be5b7fa24..47315dd55 100644 --- a/src/gui/kernel/qapplication_x11.cpp +++ b/src/gui/kernel/qapplication_x11.cpp @@ -2997,7 +2997,7 @@ static Qt::MouseButtons translateMouseButtons(int s) if (s & Button1Mask) ret |= Qt::LeftButton; if (s & Button2Mask) - ret |= Qt::MidButton; + ret |= Qt::MiddleButton; if (s & Button3Mask) ret |= Qt::RightButton; // X11 has no special state for XButton1 and XButton2, so we need to use @@ -3114,7 +3114,7 @@ bool QETWidget::translateMouseEvent(const XEvent *event) modifiers = qt_x11Data->translateModifiers(event->xbutton.state); switch (event->xbutton.button) { case Button1: button = Qt::LeftButton; break; - case Button2: button = Qt::MidButton; break; + case Button2: button = Qt::MiddleButton; break; case Button3: button = Qt::RightButton; break; case Button4: case Button5: diff --git a/src/gui/kernel/qevent.cpp b/src/gui/kernel/qevent.cpp index f117d50fd..7cc790fd9 100644 --- a/src/gui/kernel/qevent.cpp +++ b/src/gui/kernel/qevent.cpp @@ -329,7 +329,7 @@ QMouseEventEx::~QMouseEventEx() 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 @@ -1333,7 +1333,7 @@ QContextMenuEvent::QContextMenuEvent(Reason reason, const QPoint &pos) The returned value is a selection of the following values, combined with the OR operator: - Qt::LeftButton, Qt::RightButton, Qt::MidButton, + Qt::LeftButton, Qt::RightButton, Qt::MiddleButton, Qt::ShiftButton, Qt::ControlButton, and Qt::AltButton. */ diff --git a/src/gui/styles/qcommonstyle.cpp b/src/gui/styles/qcommonstyle.cpp index 5f7dbb574..cd655891d 100644 --- a/src/gui/styles/qcommonstyle.cpp +++ b/src/gui/styles/qcommonstyle.cpp @@ -4679,7 +4679,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; diff --git a/src/gui/text/qtextcontrol.cpp b/src/gui/text/qtextcontrol.cpp index 812353089..3c8979efa 100644 --- a/src/gui/text/qtextcontrol.cpp +++ b/src/gui/text/qtextcontrol.cpp @@ -1691,7 +1691,7 @@ void QTextControlPrivate::mouseReleaseEvent(QEvent *e, Qt::MouseButton button, c #ifndef QT_NO_CLIPBOARD setClipboardSelection(); selectionChanged(true); - } else if (button == Qt::MidButton + } else if (button == Qt::MiddleButton && (interactionFlags & Qt::TextEditable) && QApplication::clipboard()->supportsSelection()) { setCursorPosition(pos); diff --git a/src/gui/util/qsystemtrayicon_x11.cpp b/src/gui/util/qsystemtrayicon_x11.cpp index 87b6050fb..2c74501ae 100644 --- a/src/gui/util/qsystemtrayicon_x11.cpp +++ b/src/gui/util/qsystemtrayicon_x11.cpp @@ -298,7 +298,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); } diff --git a/src/gui/widgets/qlinecontrol.cpp b/src/gui/widgets/qlinecontrol.cpp index c98630b70..52076e5ea 100644 --- a/src/gui/widgets/qlinecontrol.cpp +++ b/src/gui/widgets/qlinecontrol.cpp @@ -1449,7 +1449,7 @@ void QLineControl::processMouseEvent(QMouseEvent* ev) if (QApplication::clipboard()->supportsSelection()) { if (ev->button() == Qt::LeftButton) { copy(QClipboard::Selection); - } else if (!isReadOnly() && ev->button() == Qt::MidButton) { + } else if (!isReadOnly() && ev->button() == Qt::MiddleButton) { deselect(); insert(QApplication::clipboard()->text(QClipboard::Selection)); } diff --git a/src/gui/widgets/qlineedit.cpp b/src/gui/widgets/qlineedit.cpp index ba0495f73..208489dc0 100644 --- a/src/gui/widgets/qlineedit.cpp +++ b/src/gui/widgets/qlineedit.cpp @@ -1424,7 +1424,7 @@ void QLineEdit::mouseReleaseEvent(QMouseEvent* e) if (QApplication::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(); insert(QApplication::clipboard()->text(QClipboard::Selection)); } diff --git a/src/gui/widgets/qmdiarea.cpp b/src/gui/widgets/qmdiarea.cpp index 78973ba65..e9f23562b 100644 --- a/src/gui/widgets/qmdiarea.cpp +++ b/src/gui/widgets/qmdiarea.cpp @@ -553,7 +553,7 @@ private: */ void QMdiAreaTabBar::mousePressEvent(QMouseEvent *event) { - if (event->button() != Qt::MidButton) { + if (event->button() != Qt::MiddleButton) { QTabBar::mousePressEvent(event); return; } diff --git a/src/gui/widgets/qscrollbar.cpp b/src/gui/widgets/qscrollbar.cpp index a0180dca2..e2adb75ee 100644 --- a/src/gui/widgets/qscrollbar.cpp +++ b/src/gui/widgets/qscrollbar.cpp @@ -527,7 +527,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->pos(), this); @@ -546,7 +546,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(); @@ -601,7 +601,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; -- 2.11.0