summaryrefslogtreecommitdiffstats
path: root/src/corelib/global
diff options
context:
space:
mode:
authorOlivier Goffart <ogoffart@woboq.com>2014-08-10 14:09:55 +0200
committerOlivier Goffart (Woboq GmbH) <ogoffart@woboq.com>2015-02-04 14:59:22 +0000
commitd446b1a5ef1f58d26b226dc185259cc2ab168db2 (patch)
tree3a3022741a28a2e34e9f7db6c4ae603af8d2823d /src/corelib/global
parent3f431e279aab16465496cc0de03a1af874c1ce65 (diff)
Use Q_ENUM and Q_FLAG in the Qt namespace
They need a special macro since they have a different metaobject Change-Id: I2fa50b4b2e45990fb01771378765b42f03139183 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
Diffstat (limited to 'src/corelib/global')
-rw-r--r--src/corelib/global/qnamespace.h143
1 files changed, 95 insertions, 48 deletions
diff --git a/src/corelib/global/qnamespace.h b/src/corelib/global/qnamespace.h
index 4a3c9c546e..5c7c435db8 100644
--- a/src/corelib/global/qnamespace.h
+++ b/src/corelib/global/qnamespace.h
@@ -42,6 +42,17 @@
QT_BEGIN_NAMESPACE
+#if !defined(Q_QDOC) && !defined(Q_MOC_RUN)
+struct QMetaObject;
+const QMetaObject *qt_getQtMetaObject() Q_DECL_NOEXCEPT; // defined in qobject.h (which can't be included here)
+#define QT_Q_ENUM(ENUM) \
+ inline const QMetaObject *qt_getEnumMetaObject(ENUM) Q_DECL_NOEXCEPT { return qt_getQtMetaObject(); } \
+ inline Q_DECL_CONSTEXPR const char *qt_getEnumName(ENUM) Q_DECL_NOEXCEPT { return #ENUM; }
+#define QT_Q_FLAG(ENUM) QT_Q_ENUM(ENUM)
+#else
+#define QT_Q_ENUM Q_ENUM
+#define QT_Q_FLAG Q_FLAG
+#endif
#ifndef Q_MOC_RUN
namespace
@@ -52,54 +63,6 @@ Qt {
#if defined(Q_MOC_RUN)
Q_OBJECT
-#endif
-
-#if defined(Q_MOC_RUN)
- // NOTE: Generally, do not add Q_ENUMS if a corresponding Q_FLAGS exists.
- Q_ENUMS(ScrollBarPolicy FocusPolicy ContextMenuPolicy)
- Q_ENUMS(ArrowType ToolButtonStyle PenStyle PenCapStyle PenJoinStyle BrushStyle)
- Q_ENUMS(FillRule MaskMode BGMode ClipOperation SizeMode)
- Q_ENUMS(Axis Corner Edge LayoutDirection SizeHint Orientation DropAction)
- Q_FLAGS(Alignment Orientations DropActions Edges)
- Q_FLAGS(DockWidgetAreas ToolBarAreas)
- Q_ENUMS(DockWidgetArea ToolBarArea)
- Q_ENUMS(TextFormat)
- Q_ENUMS(TextElideMode)
- Q_ENUMS(DateFormat TimeSpec DayOfWeek)
- Q_ENUMS(CursorShape GlobalColor)
- Q_ENUMS(AspectRatioMode TransformationMode)
- Q_FLAGS(ImageConversionFlags)
- Q_ENUMS(Key ShortcutContext)
- Q_ENUMS(TextInteractionFlag)
- Q_FLAGS(TextInteractionFlags)
- Q_ENUMS(ItemSelectionMode)
- Q_ENUMS(ItemSelectionOperation)
- Q_FLAGS(ItemFlags)
- Q_ENUMS(CheckState)
- Q_ENUMS(SortOrder CaseSensitivity)
- Q_FLAGS(MatchFlags)
- Q_FLAGS(KeyboardModifiers MouseButtons)
- Q_ENUMS(WindowType WindowState WindowModality WidgetAttribute ApplicationAttribute)
- Q_FLAGS(WindowFlags WindowStates)
- Q_ENUMS(FocusReason)
- Q_ENUMS(InputMethodHint InputMethodQuery)
- Q_FLAGS(InputMethodHints InputMethodQueries)
- Q_ENUMS(ScreenOrientation)
- Q_FLAGS(ScreenOrientations)
- Q_ENUMS(ConnectionType)
- Q_ENUMS(ApplicationState)
-#ifndef QT_NO_GESTURES
- Q_ENUMS(GestureState)
- Q_ENUMS(GestureType)
- Q_ENUMS(NativeGestureType)
-#endif
- Q_ENUMS(CursorMoveStyle)
- Q_ENUMS(TimerType)
- Q_ENUMS(ScrollPhase)
- Q_ENUMS(MouseEventSource)
-#endif // defined(Q_MOC_RUN)
-
-#if defined(Q_MOC_RUN)
public:
#endif
@@ -1644,11 +1607,95 @@ public:
};
Q_DECLARE_FLAGS(MouseEventFlags, MouseEventFlag)
+#ifndef Q_QDOC
+ // NOTE: Generally, do not add QT_Q_ENUM if a corresponding Q_Q_FLAG exists.
+ QT_Q_ENUM(ScrollBarPolicy)
+ QT_Q_ENUM(FocusPolicy)
+ QT_Q_ENUM(ContextMenuPolicy)
+ QT_Q_ENUM(ArrowType)
+ QT_Q_ENUM(ToolButtonStyle)
+ QT_Q_ENUM(PenStyle)
+ QT_Q_ENUM(PenCapStyle)
+ QT_Q_ENUM(PenJoinStyle)
+ QT_Q_ENUM(BrushStyle)
+ QT_Q_ENUM(FillRule)
+ QT_Q_ENUM(MaskMode)
+ QT_Q_ENUM(BGMode)
+ QT_Q_ENUM(ClipOperation)
+ QT_Q_ENUM(SizeMode)
+ QT_Q_ENUM(Axis)
+ QT_Q_ENUM(Corner)
+ QT_Q_ENUM(Edge)
+ QT_Q_ENUM(LayoutDirection)
+ QT_Q_ENUM(SizeHint)
+ QT_Q_ENUM(Orientation)
+ QT_Q_ENUM(DropAction)
+ QT_Q_FLAG(Alignment)
+ QT_Q_FLAG(Orientations)
+ QT_Q_FLAG(DropActions)
+ QT_Q_FLAG(Edges)
+ QT_Q_FLAG(DockWidgetAreas)
+ QT_Q_FLAG(ToolBarAreas)
+ QT_Q_ENUM(DockWidgetArea)
+ QT_Q_ENUM(ToolBarArea)
+ QT_Q_ENUM(TextFormat)
+ QT_Q_ENUM(TextElideMode)
+ QT_Q_ENUM(DateFormat)
+ QT_Q_ENUM(TimeSpec)
+ QT_Q_ENUM(DayOfWeek)
+ QT_Q_ENUM(CursorShape)
+ QT_Q_ENUM(GlobalColor)
+ QT_Q_ENUM(AspectRatioMode)
+ QT_Q_ENUM(TransformationMode)
+ QT_Q_FLAG(ImageConversionFlags)
+ QT_Q_ENUM(Key)
+ QT_Q_ENUM(ShortcutContext)
+ QT_Q_ENUM(TextInteractionFlag)
+ QT_Q_FLAG(TextInteractionFlags)
+ QT_Q_ENUM(ItemSelectionMode)
+ QT_Q_ENUM(ItemSelectionOperation)
+ QT_Q_FLAG(ItemFlags)
+ QT_Q_ENUM(CheckState)
+ QT_Q_ENUM(SortOrder)
+ QT_Q_ENUM(CaseSensitivity)
+ QT_Q_FLAG(MatchFlags)
+ QT_Q_FLAG(KeyboardModifiers)
+ QT_Q_FLAG(MouseButtons)
+ QT_Q_ENUM(WindowType)
+ QT_Q_ENUM(WindowState)
+ QT_Q_ENUM(WindowModality)
+ QT_Q_ENUM(WidgetAttribute)
+ QT_Q_ENUM(ApplicationAttribute)
+ QT_Q_FLAG(WindowFlags)
+ QT_Q_FLAG(WindowStates)
+ QT_Q_ENUM(FocusReason)
+ QT_Q_ENUM(InputMethodHint)
+ QT_Q_ENUM(InputMethodQuery)
+ QT_Q_FLAG(InputMethodHints)
+ QT_Q_FLAG(InputMethodQueries)
+ QT_Q_ENUM(ScreenOrientation)
+ QT_Q_FLAG(ScreenOrientations)
+ QT_Q_ENUM(ConnectionType)
+ QT_Q_ENUM(ApplicationState)
+#ifndef QT_NO_GESTURES
+ QT_Q_ENUM(GestureState)
+ QT_Q_ENUM(GestureType)
+ QT_Q_ENUM(NativeGestureType)
+#endif
+ QT_Q_ENUM(CursorMoveStyle)
+ QT_Q_ENUM(TimerType)
+ QT_Q_ENUM(ScrollPhase)
+ QT_Q_ENUM(MouseEventSource)
+#endif // Q_DOC
+
}
#ifdef Q_MOC_RUN
;
#endif
+#undef QT_Q_ENUM
+#undef QT_Q_FLAG
+
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::MouseButtons)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::Orientations)
Q_DECLARE_OPERATORS_FOR_FLAGS(Qt::KeyboardModifiers)