From e768d96e8bc161211b2d4ad377f3fb250f270a9b Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sat, 7 Feb 2015 13:00:27 +0100 Subject: QtGui: use Q_ENUM instead of Q_ENUMS Change-Id: I92ac2ea218e9134aa36ecb179b8ae790a2dba56a Reviewed-by: Marc Mutz --- src/gui/accessible/qaccessible.h | 3 ++- src/gui/image/qmovie.h | 3 ++- src/gui/kernel/qevent.h | 4 ++-- src/gui/kernel/qinputmethod.h | 2 +- src/gui/kernel/qkeysequence.h | 2 +- src/gui/kernel/qpalette.h | 3 ++- src/gui/kernel/qwindow.h | 3 +-- src/gui/opengl/qopengldebug.h | 2 +- src/gui/opengl/qopenglengineshadermanager_p.h | 2 +- src/gui/painting/qbrush.h | 4 +++- src/gui/text/qfont.h | 2 +- src/gui/text/qfontdatabase.h | 4 ++-- src/gui/text/qtextformat.h | 4 +++- src/gui/util/qvalidator.h | 2 +- 14 files changed, 23 insertions(+), 17 deletions(-) (limited to 'src') diff --git a/src/gui/accessible/qaccessible.h b/src/gui/accessible/qaccessible.h index 1d935cbf2d..3d41721be0 100644 --- a/src/gui/accessible/qaccessible.h +++ b/src/gui/accessible/qaccessible.h @@ -60,7 +60,6 @@ class QTextCursor; class Q_GUI_EXPORT QAccessible { Q_GADGET - Q_ENUMS(Role Event) public: enum Event { @@ -140,6 +139,7 @@ public: InvalidEvent }; + Q_ENUM(Event) // 64 bit enums seem hard on some platforms (windows...) // which makes using a bit field a sensible alternative @@ -344,6 +344,7 @@ public: UserRole = 0x0000ffff }; + Q_ENUM(Role) enum Text { Name = 0, diff --git a/src/gui/image/qmovie.h b/src/gui/image/qmovie.h index c1560fdab6..60078f9e98 100644 --- a/src/gui/image/qmovie.h +++ b/src/gui/image/qmovie.h @@ -58,7 +58,6 @@ class Q_GUI_EXPORT QMovie : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QMovie) - Q_ENUMS(MovieState CacheMode) Q_PROPERTY(int speed READ speed WRITE setSpeed) Q_PROPERTY(CacheMode cacheMode READ cacheMode WRITE setCacheMode) public: @@ -67,10 +66,12 @@ public: Paused, Running }; + Q_ENUM(MovieState) enum CacheMode { CacheNone, CacheAll }; + Q_ENUM(CacheMode) explicit QMovie(QObject *parent = 0); explicit QMovie(QIODevice *device, const QByteArray &format = QByteArray(), QObject *parent = 0); diff --git a/src/gui/kernel/qevent.h b/src/gui/kernel/qevent.h index 35a8884865..1b6d63464d 100644 --- a/src/gui/kernel/qevent.h +++ b/src/gui/kernel/qevent.h @@ -223,12 +223,12 @@ protected: class Q_GUI_EXPORT QTabletEvent : public QInputEvent { Q_GADGET - Q_ENUMS(TabletDevice) - Q_ENUMS(PointerType) public: enum TabletDevice { NoDevice, Puck, Stylus, Airbrush, FourDMouse, XFreeEraser /*internal*/, RotationStylus }; + Q_ENUM(TabletDevice) enum PointerType { UnknownPointer, Pen, Cursor, Eraser }; + Q_ENUM(PointerType) QTabletEvent(Type t, const QPointF &pos, const QPointF &globalPos, int device, int pointerType, qreal pressure, int xTilt, int yTilt, qreal tangentialPressure, qreal rotation, int z, diff --git a/src/gui/kernel/qinputmethod.h b/src/gui/kernel/qinputmethod.h index 7be25c415c..2965203de9 100644 --- a/src/gui/kernel/qinputmethod.h +++ b/src/gui/kernel/qinputmethod.h @@ -55,7 +55,6 @@ class Q_GUI_EXPORT QInputMethod : public QObject Q_PROPERTY(QLocale locale READ locale NOTIFY localeChanged) Q_PROPERTY(Qt::LayoutDirection inputDirection READ inputDirection NOTIFY inputDirectionChanged) - Q_ENUMS(Action) public: QTransform inputItemTransform() const; void setInputItemTransform(const QTransform &transform); @@ -73,6 +72,7 @@ public: Click, ContextMenu }; + Q_ENUM(Action) bool isVisible() const; void setVisible(bool visible); diff --git a/src/gui/kernel/qkeysequence.h b/src/gui/kernel/qkeysequence.h index fd2a3e9d7b..593ed03d96 100644 --- a/src/gui/kernel/qkeysequence.h +++ b/src/gui/kernel/qkeysequence.h @@ -62,7 +62,6 @@ class QKeySequencePrivate; class Q_GUI_EXPORT QKeySequence { Q_GADGET - Q_ENUMS(StandardKey) public: enum StandardKey { @@ -137,6 +136,7 @@ public: DeleteCompleteLine, Backspace }; + Q_ENUM(StandardKey) enum SequenceFormat { NativeText, diff --git a/src/gui/kernel/qpalette.h b/src/gui/kernel/qpalette.h index c877084c09..d00ddf1292 100644 --- a/src/gui/kernel/qpalette.h +++ b/src/gui/kernel/qpalette.h @@ -47,7 +47,6 @@ class QVariant; class Q_GUI_EXPORT QPalette { Q_GADGET - Q_ENUMS(ColorGroup ColorRole) public: QPalette(); QPalette(const QColor &button); @@ -80,6 +79,7 @@ public: // Do not change the order, the serialization format depends on it enum ColorGroup { Active, Disabled, Inactive, NColorGroups, Current, All, Normal = Active }; + Q_ENUM(ColorGroup) enum ColorRole { WindowText, Button, Light, Midlight, Dark, Mid, Text, BrightText, ButtonText, Base, Window, Shadow, Highlight, HighlightedText, @@ -90,6 +90,7 @@ public: NColorRoles = ToolTipText + 1, Foreground = WindowText, Background = Window }; + Q_ENUM(ColorRole) inline ColorGroup currentColorGroup() const { return static_cast(data.current_group); } inline void setCurrentColorGroup(ColorGroup cg) { data.current_group = cg; } diff --git a/src/gui/kernel/qwindow.h b/src/gui/kernel/qwindow.h index 1a6e39cd19..6778c30dd9 100644 --- a/src/gui/kernel/qwindow.h +++ b/src/gui/kernel/qwindow.h @@ -84,8 +84,6 @@ class Q_GUI_EXPORT QWindow : public QObject, public QSurface Q_OBJECT Q_DECLARE_PRIVATE(QWindow) - Q_ENUMS(Visibility) - // All properties which are declared here are inherited by QQuickWindow and therefore available in QML. // So please think carefully about what it does to the QML namespace if you add any new ones, // particularly the possible meanings these names might have in any specializations of Window. @@ -122,6 +120,7 @@ public: Maximized, FullScreen }; + Q_ENUM(Visibility) explicit QWindow(QScreen *screen = 0); explicit QWindow(QWindow *parent); diff --git a/src/gui/opengl/qopengldebug.h b/src/gui/opengl/qopengldebug.h index d0a4729d1f..eed52599d5 100644 --- a/src/gui/opengl/qopengldebug.h +++ b/src/gui/opengl/qopengldebug.h @@ -147,7 +147,6 @@ class QOpenGLDebugLoggerPrivate; class Q_GUI_EXPORT QOpenGLDebugLogger : public QObject { Q_OBJECT - Q_ENUMS(LoggingMode) Q_PROPERTY(LoggingMode loggingMode READ loggingMode) public: @@ -155,6 +154,7 @@ public: AsynchronousLogging, SynchronousLogging }; + Q_ENUM(LoggingMode) explicit QOpenGLDebugLogger(QObject *parent = 0); ~QOpenGLDebugLogger(); diff --git a/src/gui/opengl/qopenglengineshadermanager_p.h b/src/gui/opengl/qopenglengineshadermanager_p.h index 56aa18cb6b..4ae7c7d03b 100644 --- a/src/gui/opengl/qopenglengineshadermanager_p.h +++ b/src/gui/opengl/qopenglengineshadermanager_p.h @@ -324,7 +324,7 @@ public: TotalSnippetCount, InvalidSnippetName }; #if defined (QT_DEBUG) - Q_ENUMS(SnippetName) + Q_ENUM(SnippetName) static QByteArray snippetNameStr(SnippetName snippetName); #endif diff --git a/src/gui/painting/qbrush.h b/src/gui/painting/qbrush.h index 3dc2230afc..508a901d8f 100644 --- a/src/gui/painting/qbrush.h +++ b/src/gui/painting/qbrush.h @@ -167,7 +167,6 @@ typedef QVector QGradientStops; class Q_GUI_EXPORT QGradient { Q_GADGET - Q_ENUMS(Type Spread CoordinateMode) public: enum Type { LinearGradient, @@ -175,18 +174,21 @@ public: ConicalGradient, NoGradient }; + Q_ENUM(Type) enum Spread { PadSpread, ReflectSpread, RepeatSpread }; + Q_ENUM(Spread) enum CoordinateMode { LogicalMode, StretchToDeviceMode, ObjectBoundingMode }; + Q_ENUM(CoordinateMode) enum InterpolationMode { ColorInterpolation, diff --git a/src/gui/text/qfont.h b/src/gui/text/qfont.h index 165c4a85b9..a1baa6fceb 100644 --- a/src/gui/text/qfont.h +++ b/src/gui/text/qfont.h @@ -49,7 +49,6 @@ class QVariant; class Q_GUI_EXPORT QFont { Q_GADGET - Q_ENUMS(StyleStrategy) public: enum StyleHint { Helvetica, SansSerif = Helvetica, @@ -78,6 +77,7 @@ public: NoSubpixelAntialias = 0x0800, NoFontMerging = 0x8000 }; + Q_ENUM(StyleStrategy) enum HintingPreference { PreferDefaultHinting = 0, diff --git a/src/gui/text/qfontdatabase.h b/src/gui/text/qfontdatabase.h index 4e1ab501ba..b63cdb7c61 100644 --- a/src/gui/text/qfontdatabase.h +++ b/src/gui/text/qfontdatabase.h @@ -51,8 +51,6 @@ class QFontDatabasePrivate; class Q_GUI_EXPORT QFontDatabase { Q_GADGET - Q_ENUMS(WritingSystem) - Q_ENUMS(SystemFont) public: // do not re-order or delete entries from this enum without updating the // QPF2 format and makeqpf!! @@ -98,6 +96,7 @@ public: WritingSystemsCount }; + Q_ENUM(WritingSystem) enum SystemFont { GeneralFont, @@ -105,6 +104,7 @@ public: TitleFont, SmallestReadableFont }; + Q_ENUM(SystemFont) static QList standardSizes(); diff --git a/src/gui/text/qtextformat.h b/src/gui/text/qtextformat.h index 94c5b83cc0..370e8a96b8 100644 --- a/src/gui/text/qtextformat.h +++ b/src/gui/text/qtextformat.h @@ -126,7 +126,6 @@ Q_GUI_EXPORT QDebug operator<<(QDebug, const QTextFormat &); class Q_GUI_EXPORT QTextFormat { Q_GADGET - Q_ENUMS(FormatType Property ObjectTypes) public: enum FormatType { InvalidFormat = -1, @@ -140,6 +139,7 @@ public: UserFormat = 100 }; + Q_ENUM(FormatType) enum Property { ObjectIndex = 0x0, @@ -257,6 +257,7 @@ public: // -- UserProperty = 0x100000 }; + Q_ENUM(Property) enum ObjectTypes { NoObject, @@ -266,6 +267,7 @@ public: UserObject = 0x1000 }; + Q_ENUM(ObjectTypes) enum PageBreakFlag { PageBreak_Auto = 0, diff --git a/src/gui/util/qvalidator.h b/src/gui/util/qvalidator.h index d78a96de3f..dfaa9d87a4 100644 --- a/src/gui/util/qvalidator.h +++ b/src/gui/util/qvalidator.h @@ -120,7 +120,6 @@ class Q_GUI_EXPORT QDoubleValidator : public QValidator Q_PROPERTY(double bottom READ bottom WRITE setBottom NOTIFY bottomChanged) Q_PROPERTY(double top READ top WRITE setTop NOTIFY topChanged) Q_PROPERTY(int decimals READ decimals WRITE setDecimals NOTIFY decimalsChanged) - Q_ENUMS(Notation) Q_PROPERTY(Notation notation READ notation WRITE setNotation NOTIFY notationChanged) public: @@ -132,6 +131,7 @@ public: StandardNotation, ScientificNotation }; + Q_ENUM(Notation) QValidator::State validate(QString &, int &) const Q_DECL_OVERRIDE; virtual void setRange(double bottom, double top, int decimals = 0); -- cgit v1.2.3