Use Q_ENUM and Q_FLAG for types in QtCore

Change-Id: I33590a9c4c6d87c5bbba1d201e32c6bf1bd3e00b
Reviewed-by: Lars Knoll <lars.knoll@digia.com>
Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
This commit is contained in:
Olivier Goffart 2014-08-10 19:31:57 +02:00 committed by Olivier Goffart (Woboq GmbH)
parent d446b1a5ef
commit 7d6c6bc082
9 changed files with 16 additions and 12 deletions

View File

@ -49,8 +49,7 @@ class QAbstractAnimationPrivate;
class Q_CORE_EXPORT QAbstractAnimation : public QObject
{
Q_OBJECT
Q_ENUMS(State)
Q_ENUMS(Direction)
Q_PROPERTY(State state READ state NOTIFY stateChanged)
Q_PROPERTY(int loopCount READ loopCount WRITE setLoopCount)
Q_PROPERTY(int currentTime READ currentTime WRITE setCurrentTime)
@ -63,12 +62,14 @@ public:
Forward,
Backward
};
Q_ENUM(Direction)
enum State {
Stopped,
Paused,
Running
};
Q_ENUM(State)
enum DeletionPolicy {
KeepWhenStopped = 0,

View File

@ -155,7 +155,6 @@ template <class Key, class T> class QMap;
class Q_CORE_EXPORT QAbstractItemModel : public QObject
{
Q_OBJECT
Q_ENUMS(LayoutChangeHint)
friend class QPersistentModelIndexData;
friend class QAbstractItemViewPrivate;
@ -239,6 +238,7 @@ public:
VerticalSortHint,
HorizontalSortHint
};
Q_ENUM(LayoutChangeHint)
Q_SIGNALS:
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight, const QVector<int> &roles = QVector<int>());

View File

@ -148,7 +148,6 @@ class Q_CORE_EXPORT QItemSelectionModel : public QObject
Q_PROPERTY(QModelIndex currentIndex READ currentIndex NOTIFY currentChanged STORED false DESIGNABLE false)
Q_DECLARE_PRIVATE(QItemSelectionModel)
Q_FLAGS(SelectionFlags)
public:
@ -167,6 +166,7 @@ public:
};
Q_DECLARE_FLAGS(SelectionFlags, SelectionFlag)
Q_FLAG(SelectionFlags)
explicit QItemSelectionModel(QAbstractItemModel *model = 0);
explicit QItemSelectionModel(QAbstractItemModel *model, QObject *parent);

View File

@ -46,7 +46,6 @@ class Q_CORE_EXPORT QEvent // event base class
{
Q_GADGET
QDOC_PROPERTY(bool accepted READ isAccepted WRITE setAccepted)
Q_ENUMS(Type)
public:
enum Type {
/*
@ -283,6 +282,7 @@ public:
User = 1000, // first user event id
MaxUser = 65535 // last user event id
};
Q_ENUM(Type)
explicit QEvent(Type type);
QEvent(const QEvent &other);

View File

@ -47,7 +47,6 @@ class Q_CORE_EXPORT QLibrary : public QObject
Q_OBJECT
Q_PROPERTY(QString fileName READ fileName WRITE setFileName)
Q_PROPERTY(LoadHints loadHints READ loadHints WRITE setLoadHints)
Q_FLAGS(LoadHint LoadHints)
public:
enum LoadHint {
ResolveAllSymbolsHint = 0x01,
@ -57,6 +56,8 @@ public:
DeepBindHint = 0x10
};
Q_DECLARE_FLAGS(LoadHints, LoadHint)
Q_FLAG(LoadHint)
Q_FLAG(LoadHints)
explicit QLibrary(QObject *parent = 0);
explicit QLibrary(const QString& fileName, QObject *parent = 0);

View File

@ -47,12 +47,12 @@ class Q_CORE_EXPORT QHistoryState : public QAbstractState
Q_OBJECT
Q_PROPERTY(QAbstractState* defaultState READ defaultState WRITE setDefaultState NOTIFY defaultStateChanged)
Q_PROPERTY(HistoryType historyType READ historyType WRITE setHistoryType NOTIFY historyTypeChanged)
Q_ENUMS(HistoryType)
public:
enum HistoryType {
ShallowHistory,
DeepHistory
};
Q_ENUM(HistoryType)
QHistoryState(QState *parent = 0);
QHistoryState(HistoryType type, QState *parent = 0);

View File

@ -53,17 +53,18 @@ class Q_CORE_EXPORT QState : public QAbstractState
Q_PROPERTY(QAbstractState* initialState READ initialState WRITE setInitialState NOTIFY initialStateChanged)
Q_PROPERTY(QAbstractState* errorState READ errorState WRITE setErrorState NOTIFY errorStateChanged)
Q_PROPERTY(ChildMode childMode READ childMode WRITE setChildMode NOTIFY childModeChanged)
Q_ENUMS(ChildMode RestorePolicy)
public:
enum ChildMode {
ExclusiveStates,
ParallelStates
};
Q_ENUM(ChildMode)
enum RestorePolicy {
DontRestoreProperties,
RestoreProperties
};
Q_ENUM(RestorePolicy)
QState(QState *parent = 0);
QState(ChildMode childMode, QState *parent = 0);

View File

@ -50,7 +50,6 @@ class QPointF;
class Q_CORE_EXPORT QEasingCurve
{
Q_GADGET
Q_ENUMS(Type)
public:
enum Type {
Linear,
@ -67,6 +66,7 @@ public:
InCurve, OutCurve, SineCurve, CosineCurve,
BezierSpline, TCBSpline, Custom, NCurveTypes
};
Q_ENUM(Type)
QEasingCurve(Type type = Linear);
QEasingCurve(const QEasingCurve &other);

View File

@ -55,9 +55,6 @@ class QLocalePrivate;
class Q_CORE_EXPORT QLocale
{
Q_GADGET
Q_ENUMS(Language)
Q_ENUMS(Country)
Q_ENUMS(MeasurementSystem)
friend class QString;
friend class QStringRef;
friend class QByteArray;
@ -781,12 +778,16 @@ public:
};
// GENERATED PART ENDS HERE
Q_ENUM(Language)
Q_ENUM(Country)
enum MeasurementSystem {
MetricSystem,
ImperialUSSystem,
ImperialUKSystem,
ImperialSystem = ImperialUSSystem // Qt 4 compatibility
};
Q_ENUM(MeasurementSystem)
enum FormatType { LongFormat, ShortFormat, NarrowFormat };
enum NumberOption {