From 163b8529516ddda24833f635f737863ba98bd688 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Sat, 7 Feb 2015 13:00:49 +0100 Subject: QtWidgets: use Q_ENUM instead of Q_ENUMS Change-Id: Id5280c1d9feab95e1506569f3d0eb23eeb74935f Reviewed-by: Marc Mutz --- src/widgets/dialogs/qcolordialog.h | 2 +- src/widgets/dialogs/qfiledialog.h | 5 ++++- src/widgets/dialogs/qfontdialog.h | 2 +- src/widgets/dialogs/qmessagebox.h | 2 +- src/widgets/dialogs/qwizard.h | 3 ++- src/widgets/graphicsview/qgraphicsview.h | 4 +++- src/widgets/itemviews/qabstractitemview.h | 6 +++++- src/widgets/itemviews/qdatawidgetmapper.h | 2 +- src/widgets/itemviews/qheaderview.h | 2 +- src/widgets/itemviews/qlistview.h | 6 +++++- src/widgets/kernel/qaction.h | 4 ++-- src/widgets/kernel/qformlayout.h | 4 +++- src/widgets/kernel/qgesture.h | 2 +- src/widgets/kernel/qlayout.h | 2 +- src/widgets/kernel/qsizepolicy.h | 2 +- src/widgets/kernel/qstackedlayout.h | 2 +- src/widgets/styles/qstyle.h | 14 +++++++++++--- src/widgets/util/qscroller.h | 2 +- src/widgets/widgets/qabstractscrollarea.h | 2 +- src/widgets/widgets/qabstractspinbox.h | 4 ++-- src/widgets/widgets/qcalendarwidget.h | 6 +++--- src/widgets/widgets/qcombobox.h | 4 ++-- src/widgets/widgets/qdatetimeedit.h | 2 +- src/widgets/widgets/qframe.h | 3 ++- src/widgets/widgets/qlcdnumber.h | 3 ++- src/widgets/widgets/qlineedit.h | 3 ++- src/widgets/widgets/qmainwindow.h | 2 +- src/widgets/widgets/qmdiarea.h | 4 ++-- src/widgets/widgets/qplaintextedit.h | 2 +- src/widgets/widgets/qprogressbar.h | 2 +- src/widgets/widgets/qslider.h | 2 +- src/widgets/widgets/qtabbar.h | 2 +- src/widgets/widgets/qtabwidget.h | 3 ++- src/widgets/widgets/qtextedit.h | 2 +- src/widgets/widgets/qtoolbutton.h | 3 ++- 35 files changed, 72 insertions(+), 43 deletions(-) diff --git a/src/widgets/dialogs/qcolordialog.h b/src/widgets/dialogs/qcolordialog.h index 87e62be81f..e583aa246e 100644 --- a/src/widgets/dialogs/qcolordialog.h +++ b/src/widgets/dialogs/qcolordialog.h @@ -47,7 +47,6 @@ class Q_WIDGETS_EXPORT QColorDialog : public QDialog { Q_OBJECT Q_DECLARE_PRIVATE(QColorDialog) - Q_ENUMS(ColorDialogOption) Q_PROPERTY(QColor currentColor READ currentColor WRITE setCurrentColor NOTIFY currentColorChanged) Q_PROPERTY(ColorDialogOptions options READ options WRITE setOptions) @@ -58,6 +57,7 @@ public: NoButtons = 0x00000002, DontUseNativeDialog = 0x00000004 }; + Q_ENUM(ColorDialogOption) Q_DECLARE_FLAGS(ColorDialogOptions, ColorDialogOption) diff --git a/src/widgets/dialogs/qfiledialog.h b/src/widgets/dialogs/qfiledialog.h index c991256eef..607590be50 100644 --- a/src/widgets/dialogs/qfiledialog.h +++ b/src/widgets/dialogs/qfiledialog.h @@ -55,7 +55,6 @@ class QAbstractProxyModel; class Q_WIDGETS_EXPORT QFileDialog : public QDialog { Q_OBJECT - Q_ENUMS(ViewMode FileMode AcceptMode Option) Q_FLAGS(Options) Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode) Q_PROPERTY(FileMode fileMode READ fileMode WRITE setFileMode) @@ -70,8 +69,11 @@ class Q_WIDGETS_EXPORT QFileDialog : public QDialog public: enum ViewMode { Detail, List }; + Q_ENUM(ViewMode) enum FileMode { AnyFile, ExistingFile, Directory, ExistingFiles, DirectoryOnly }; + Q_ENUM(FileMode) enum AcceptMode { AcceptOpen, AcceptSave }; + Q_ENUM(AcceptMode) enum DialogLabel { LookIn, FileName, FileType, Accept, Reject }; enum Option @@ -85,6 +87,7 @@ public: HideNameFilterDetails = 0x00000040, DontUseCustomDirectoryIcons = 0x00000080 }; + Q_ENUM(Option) Q_DECLARE_FLAGS(Options, Option) QFileDialog(QWidget *parent, Qt::WindowFlags f); diff --git a/src/widgets/dialogs/qfontdialog.h b/src/widgets/dialogs/qfontdialog.h index a065f8bebf..41768b90f0 100644 --- a/src/widgets/dialogs/qfontdialog.h +++ b/src/widgets/dialogs/qfontdialog.h @@ -49,7 +49,6 @@ class Q_WIDGETS_EXPORT QFontDialog : public QDialog { Q_OBJECT Q_DECLARE_PRIVATE(QFontDialog) - Q_ENUMS(FontDialogOption) Q_PROPERTY(QFont currentFont READ currentFont WRITE setCurrentFont NOTIFY currentFontChanged) Q_PROPERTY(FontDialogOptions options READ options WRITE setOptions) @@ -62,6 +61,7 @@ public: MonospacedFonts = 0x00000010, ProportionalFonts = 0x00000020 }; + Q_ENUM(FontDialogOption) Q_DECLARE_FLAGS(FontDialogOptions, FontDialogOption) diff --git a/src/widgets/dialogs/qmessagebox.h b/src/widgets/dialogs/qmessagebox.h index f75331c967..bd15bda052 100644 --- a/src/widgets/dialogs/qmessagebox.h +++ b/src/widgets/dialogs/qmessagebox.h @@ -49,7 +49,6 @@ class QCheckBox; class Q_WIDGETS_EXPORT QMessageBox : public QDialog { Q_OBJECT - Q_ENUMS(Icon) Q_FLAGS(StandardButtons) Q_PROPERTY(QString text READ text WRITE setText) Q_PROPERTY(Icon icon READ icon WRITE setIcon) @@ -71,6 +70,7 @@ public: Critical = 3, Question = 4 }; + Q_ENUM(Icon) enum ButtonRole { // keep this in sync with QDialogButtonBox::ButtonRole and QPlatformDialogHelper::ButtonRole diff --git a/src/widgets/dialogs/qwizard.h b/src/widgets/dialogs/qwizard.h index 7ceddf5049..ee2227a79e 100644 --- a/src/widgets/dialogs/qwizard.h +++ b/src/widgets/dialogs/qwizard.h @@ -48,7 +48,6 @@ class QWizardPrivate; class Q_WIDGETS_EXPORT QWizard : public QDialog { Q_OBJECT - Q_ENUMS(WizardStyle WizardOption) Q_FLAGS(WizardOptions) Q_PROPERTY(WizardStyle wizardStyle READ wizardStyle WRITE setWizardStyle) Q_PROPERTY(WizardOptions options READ options WRITE setOptions) @@ -74,6 +73,7 @@ public: NStandardButtons = 6, NButtons = 9 }; + Q_ENUM(WizardButton) enum WizardPixmap { WatermarkPixmap, @@ -110,6 +110,7 @@ public: HaveCustomButton3 = 0x00008000, NoCancelButtonOnLastPage = 0x00010000 }; + Q_ENUM(WizardOption) Q_DECLARE_FLAGS(WizardOptions, WizardOption) diff --git a/src/widgets/graphicsview/qgraphicsview.h b/src/widgets/graphicsview/qgraphicsview.h index 39c28a1b64..3dea0273b2 100644 --- a/src/widgets/graphicsview/qgraphicsview.h +++ b/src/widgets/graphicsview/qgraphicsview.h @@ -54,7 +54,6 @@ class Q_WIDGETS_EXPORT QGraphicsView : public QAbstractScrollArea { Q_OBJECT Q_FLAGS(QPainter::RenderHints CacheMode OptimizationFlags) - Q_ENUMS(ViewportAnchor DragMode ViewportUpdateMode) Q_PROPERTY(QBrush backgroundBrush READ backgroundBrush WRITE setBackgroundBrush) Q_PROPERTY(QBrush foregroundBrush READ foregroundBrush WRITE setForegroundBrush) Q_PROPERTY(bool interactive READ isInteractive WRITE setInteractive) @@ -77,6 +76,7 @@ public: AnchorViewCenter, AnchorUnderMouse }; + Q_ENUM(ViewportAnchor) enum CacheModeFlag { CacheNone = 0x0, @@ -89,6 +89,7 @@ public: ScrollHandDrag, RubberBandDrag }; + Q_ENUM(DragMode) enum ViewportUpdateMode { FullViewportUpdate, @@ -97,6 +98,7 @@ public: NoViewportUpdate, BoundingRectViewportUpdate }; + Q_ENUM(ViewportUpdateMode) enum OptimizationFlag { DontClipPainter = 0x1, // obsolete diff --git a/src/widgets/itemviews/qabstractitemview.h b/src/widgets/itemviews/qabstractitemview.h index 28c43633ea..c76d8f4b2f 100644 --- a/src/widgets/itemviews/qabstractitemview.h +++ b/src/widgets/itemviews/qabstractitemview.h @@ -52,7 +52,6 @@ class QAbstractItemViewPrivate; class Q_WIDGETS_EXPORT QAbstractItemView : public QAbstractScrollArea { Q_OBJECT - Q_ENUMS(SelectionMode SelectionBehavior ScrollHint ScrollMode DragDropMode) Q_FLAGS(EditTriggers) Q_PROPERTY(bool autoScroll READ hasAutoScroll WRITE setAutoScroll) Q_PROPERTY(int autoScrollMargin READ autoScrollMargin WRITE setAutoScrollMargin) @@ -81,12 +80,14 @@ public: ExtendedSelection, ContiguousSelection }; + Q_ENUM(SelectionMode) enum SelectionBehavior { SelectItems, SelectRows, SelectColumns }; + Q_ENUM(SelectionBehavior) enum ScrollHint { EnsureVisible, @@ -94,6 +95,7 @@ public: PositionAtBottom, PositionAtCenter }; + Q_ENUM(ScrollHint) enum EditTrigger { NoEditTriggers = 0, @@ -111,6 +113,7 @@ public: ScrollPerItem, ScrollPerPixel }; + Q_ENUM(ScrollMode) explicit QAbstractItemView(QWidget *parent = 0); ~QAbstractItemView(); @@ -168,6 +171,7 @@ public: DragDrop, InternalMove }; + Q_ENUM(DragDropMode) void setDragDropMode(DragDropMode behavior); DragDropMode dragDropMode() const; diff --git a/src/widgets/itemviews/qdatawidgetmapper.h b/src/widgets/itemviews/qdatawidgetmapper.h index 2afbd0ae87..b5e495a28a 100644 --- a/src/widgets/itemviews/qdatawidgetmapper.h +++ b/src/widgets/itemviews/qdatawidgetmapper.h @@ -50,7 +50,6 @@ class Q_WIDGETS_EXPORT QDataWidgetMapper: public QObject { Q_OBJECT - Q_ENUMS(SubmitPolicy) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentIndexChanged) Q_PROPERTY(Qt::Orientation orientation READ orientation WRITE setOrientation) Q_PROPERTY(SubmitPolicy submitPolicy READ submitPolicy WRITE setSubmitPolicy) @@ -72,6 +71,7 @@ public: Qt::Orientation orientation() const; enum SubmitPolicy { AutoSubmit, ManualSubmit }; + Q_ENUM(SubmitPolicy) void setSubmitPolicy(SubmitPolicy policy); SubmitPolicy submitPolicy() const; diff --git a/src/widgets/itemviews/qheaderview.h b/src/widgets/itemviews/qheaderview.h index 0163243cdf..7c08ccc86a 100644 --- a/src/widgets/itemviews/qheaderview.h +++ b/src/widgets/itemviews/qheaderview.h @@ -55,7 +55,6 @@ class Q_WIDGETS_EXPORT QHeaderView : public QAbstractItemView Q_PROPERTY(int minimumSectionSize READ minimumSectionSize WRITE setMinimumSectionSize) Q_PROPERTY(int maximumSectionSize READ maximumSectionSize WRITE setMaximumSectionSize) Q_PROPERTY(Qt::Alignment defaultAlignment READ defaultAlignment WRITE setDefaultAlignment) - Q_ENUMS(ResizeMode) public: @@ -67,6 +66,7 @@ public: ResizeToContents, Custom = Fixed }; + Q_ENUM(ResizeMode) explicit QHeaderView(Qt::Orientation orientation, QWidget *parent = 0); virtual ~QHeaderView(); diff --git a/src/widgets/itemviews/qlistview.h b/src/widgets/itemviews/qlistview.h index 8e4cc7ff41..7a4637ed75 100644 --- a/src/widgets/itemviews/qlistview.h +++ b/src/widgets/itemviews/qlistview.h @@ -46,7 +46,6 @@ class QListViewPrivate; class Q_WIDGETS_EXPORT QListView : public QAbstractItemView { Q_OBJECT - Q_ENUMS(Movement Flow ResizeMode LayoutMode ViewMode) Q_PROPERTY(Movement movement READ movement WRITE setMovement) Q_PROPERTY(Flow flow READ flow WRITE setFlow) Q_PROPERTY(bool isWrapping READ isWrapping WRITE setWrapping) @@ -63,10 +62,15 @@ class Q_WIDGETS_EXPORT QListView : public QAbstractItemView public: enum Movement { Static, Free, Snap }; + Q_ENUM(Movement) enum Flow { LeftToRight, TopToBottom }; + Q_ENUM(Flow) enum ResizeMode { Fixed, Adjust }; + Q_ENUM(ResizeMode) enum LayoutMode { SinglePass, Batched }; + Q_ENUM(LayoutMode) enum ViewMode { ListMode, IconMode }; + Q_ENUM(ViewMode) explicit QListView(QWidget *parent = 0); ~QListView(); diff --git a/src/widgets/kernel/qaction.h b/src/widgets/kernel/qaction.h index 4fc4b424f6..db8231002c 100644 --- a/src/widgets/kernel/qaction.h +++ b/src/widgets/kernel/qaction.h @@ -55,8 +55,6 @@ class Q_WIDGETS_EXPORT QAction : public QObject Q_OBJECT Q_DECLARE_PRIVATE(QAction) - Q_ENUMS(MenuRole) - Q_ENUMS(Priority) Q_PROPERTY(bool checkable READ isCheckable WRITE setCheckable NOTIFY changed) Q_PROPERTY(bool checked READ isChecked WRITE setChecked DESIGNABLE isCheckable NOTIFY toggled) Q_PROPERTY(bool enabled READ isEnabled WRITE setEnabled NOTIFY changed) @@ -81,9 +79,11 @@ public: // note this is copied into qplatformmenu.h, which must stay in sync enum MenuRole { NoRole = 0, TextHeuristicRole, ApplicationSpecificRole, AboutQtRole, AboutRole, PreferencesRole, QuitRole }; + Q_ENUM(MenuRole) enum Priority { LowPriority = 0, NormalPriority = 128, HighPriority = 256}; + Q_ENUM(Priority) explicit QAction(QObject* parent); QAction(const QString &text, QObject* parent); QAction(const QIcon &icon, const QString &text, QObject* parent); diff --git a/src/widgets/kernel/qformlayout.h b/src/widgets/kernel/qformlayout.h index e06f1f7375..66ec926b29 100644 --- a/src/widgets/kernel/qformlayout.h +++ b/src/widgets/kernel/qformlayout.h @@ -44,7 +44,6 @@ class QFormLayoutPrivate; class Q_WIDGETS_EXPORT QFormLayout : public QLayout { Q_OBJECT - Q_ENUMS(FieldGrowthPolicy RowWrapPolicy ItemRole) Q_DECLARE_PRIVATE(QFormLayout) Q_PROPERTY(FieldGrowthPolicy fieldGrowthPolicy READ fieldGrowthPolicy WRITE setFieldGrowthPolicy RESET resetFieldGrowthPolicy) Q_PROPERTY(RowWrapPolicy rowWrapPolicy READ rowWrapPolicy WRITE setRowWrapPolicy RESET resetRowWrapPolicy) @@ -59,18 +58,21 @@ public: ExpandingFieldsGrow, AllNonFixedFieldsGrow }; + Q_ENUM(FieldGrowthPolicy) enum RowWrapPolicy { DontWrapRows, WrapLongRows, WrapAllRows }; + Q_ENUM(RowWrapPolicy) enum ItemRole { LabelRole = 0, FieldRole = 1, SpanningRole = 2 }; + Q_ENUM(ItemRole) explicit QFormLayout(QWidget *parent = 0); ~QFormLayout(); diff --git a/src/widgets/kernel/qgesture.h b/src/widgets/kernel/qgesture.h index a66132566b..4796a1ca4d 100644 --- a/src/widgets/kernel/qgesture.h +++ b/src/widgets/kernel/qgesture.h @@ -200,7 +200,6 @@ class Q_WIDGETS_EXPORT QSwipeGesture : public QGesture { Q_OBJECT Q_DECLARE_PRIVATE(QSwipeGesture) - Q_ENUMS(SwipeDirection) Q_PROPERTY(SwipeDirection horizontalDirection READ horizontalDirection STORED false) Q_PROPERTY(SwipeDirection verticalDirection READ verticalDirection STORED false) @@ -209,6 +208,7 @@ class Q_WIDGETS_EXPORT QSwipeGesture : public QGesture public: enum SwipeDirection { NoDirection, Left, Right, Up, Down }; + Q_ENUM(SwipeDirection) explicit QSwipeGesture(QObject *parent = 0); ~QSwipeGesture(); diff --git a/src/widgets/kernel/qlayout.h b/src/widgets/kernel/qlayout.h index 8bcbb700f4..9400ce442e 100644 --- a/src/widgets/kernel/qlayout.h +++ b/src/widgets/kernel/qlayout.h @@ -56,7 +56,6 @@ class Q_WIDGETS_EXPORT QLayout : public QObject, public QLayoutItem Q_OBJECT Q_DECLARE_PRIVATE(QLayout) - Q_ENUMS(SizeConstraint) Q_PROPERTY(int margin READ margin WRITE setMargin) Q_PROPERTY(int spacing READ spacing WRITE setSpacing) Q_PROPERTY(SizeConstraint sizeConstraint READ sizeConstraint WRITE setSizeConstraint) @@ -69,6 +68,7 @@ public: SetMaximumSize, SetMinAndMaxSize }; + Q_ENUM(SizeConstraint) QLayout(QWidget *parent); QLayout(); diff --git a/src/widgets/kernel/qsizepolicy.h b/src/widgets/kernel/qsizepolicy.h index 3a4fa80ba7..26d626b1f6 100644 --- a/src/widgets/kernel/qsizepolicy.h +++ b/src/widgets/kernel/qsizepolicy.h @@ -44,7 +44,6 @@ class QVariant; class Q_WIDGETS_EXPORT QSizePolicy { Q_GADGET - Q_ENUMS(Policy) Q_FLAGS(ControlTypes) public: @@ -64,6 +63,7 @@ public: Expanding = GrowFlag | ShrinkFlag | ExpandFlag, Ignored = ShrinkFlag | GrowFlag | IgnoreFlag }; + Q_ENUM(Policy) enum ControlType { DefaultType = 0x00000001, diff --git a/src/widgets/kernel/qstackedlayout.h b/src/widgets/kernel/qstackedlayout.h index afa45afc68..0d8c990668 100644 --- a/src/widgets/kernel/qstackedlayout.h +++ b/src/widgets/kernel/qstackedlayout.h @@ -45,7 +45,6 @@ class Q_WIDGETS_EXPORT QStackedLayout : public QLayout { Q_OBJECT Q_DECLARE_PRIVATE(QStackedLayout) - Q_ENUMS(StackingMode) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) Q_PROPERTY(StackingMode stackingMode READ stackingMode WRITE setStackingMode) QDOC_PROPERTY(int count READ count) @@ -55,6 +54,7 @@ public: StackOne, StackAll }; + Q_ENUM(StackingMode) QStackedLayout(); explicit QStackedLayout(QWidget *parent); diff --git a/src/widgets/styles/qstyle.h b/src/widgets/styles/qstyle.h index 225146c5bb..04d262b188 100644 --- a/src/widgets/styles/qstyle.h +++ b/src/widgets/styles/qstyle.h @@ -58,9 +58,6 @@ class Q_WIDGETS_EXPORT QStyle : public QObject { Q_OBJECT Q_DECLARE_PRIVATE(QStyle) - Q_ENUMS(StateFlag PrimitiveElement ControlElement SubElement ComplexControl) - Q_ENUMS(SubControl PixelMetric ContentsType RequestSoftwareInputPanel StyleHint) - Q_ENUMS(StandardPixmap) protected: QStyle(QStylePrivate &dd); @@ -125,6 +122,7 @@ public: State_Small = 0x04000000, State_Mini = 0x08000000 }; + Q_ENUM(StateFlag) Q_DECLARE_FLAGS(State, StateFlag) @@ -191,6 +189,7 @@ public: // do not add any values below/greater this PE_CustomBase = 0xf000000 }; + Q_ENUM(PrimitiveElement) virtual void drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPainter *p, const QWidget *w = 0) const = 0; @@ -261,6 +260,7 @@ public: // do not add any values below/greater than this CE_CustomBase = 0xf0000000 }; + Q_ENUM(ControlElement) virtual void drawControl(ControlElement element, const QStyleOption *opt, QPainter *p, const QWidget *w = 0) const = 0; @@ -344,6 +344,7 @@ public: // do not add any values below/greater than this SE_CustomBase = 0xf0000000 }; + Q_ENUM(SubElement) virtual QRect subElementRect(SubElement subElement, const QStyleOption *option, const QWidget *widget = 0) const = 0; @@ -363,6 +364,7 @@ public: // do not add any values below/greater than this CC_CustomBase = 0xf0000000 }; + Q_ENUM(ComplexControl) enum SubControl { SC_None = 0x00000000, @@ -419,6 +421,7 @@ public: SC_CustomBase = 0xf0000000, SC_All = 0xffffffff }; + Q_ENUM(SubControl) Q_DECLARE_FLAGS(SubControls, SubControl) @@ -556,6 +559,7 @@ public: // do not add any values below/greater than this PM_CustomBase = 0xf0000000 }; + Q_ENUM(PixelMetric) virtual int pixelMetric(PixelMetric metric, const QStyleOption *option = 0, const QWidget *widget = 0) const = 0; @@ -587,6 +591,7 @@ public: // do not add any values below/greater than this CT_CustomBase = 0xf0000000 }; + Q_ENUM(ContentsType) virtual QSize sizeFromContents(ContentsType ct, const QStyleOption *opt, const QSize &contentsSize, const QWidget *w = 0) const = 0; @@ -595,6 +600,7 @@ public: RSIP_OnMouseClickAndAlreadyFocused, RSIP_OnMouseClick }; + Q_ENUM(RequestSoftwareInputPanel) enum StyleHint { SH_EtchDisabledText, @@ -716,6 +722,7 @@ public: SH_CustomBase = 0xf0000000 }; + Q_ENUM(StyleHint) virtual int styleHint(StyleHint stylehint, const QStyleOption *opt = 0, const QWidget *widget = 0, QStyleHintReturn* returnData = 0) const = 0; @@ -795,6 +802,7 @@ public: // do not add any values below/greater than this SP_CustomBase = 0xf0000000 }; + Q_ENUM(StandardPixmap) virtual QPixmap standardPixmap(StandardPixmap standardPixmap, const QStyleOption *opt = 0, const QWidget *widget = 0) const = 0; diff --git a/src/widgets/util/qscroller.h b/src/widgets/util/qscroller.h index bdbd015711..c6c39e8808 100644 --- a/src/widgets/util/qscroller.h +++ b/src/widgets/util/qscroller.h @@ -54,7 +54,6 @@ class Q_WIDGETS_EXPORT QScroller : public QObject Q_OBJECT Q_PROPERTY(State state READ state NOTIFY stateChanged) Q_PROPERTY(QScrollerProperties scrollerProperties READ scrollerProperties WRITE setScrollerProperties NOTIFY scrollerPropertiesChanged) - Q_ENUMS(State) public: enum State @@ -64,6 +63,7 @@ public: Dragging, Scrolling }; + Q_ENUM(State) enum ScrollerGestureType { diff --git a/src/widgets/widgets/qabstractscrollarea.h b/src/widgets/widgets/qabstractscrollarea.h index 6a9a86b07f..9ce8d286b7 100644 --- a/src/widgets/widgets/qabstractscrollarea.h +++ b/src/widgets/widgets/qabstractscrollarea.h @@ -49,7 +49,6 @@ class Q_WIDGETS_EXPORT QAbstractScrollArea : public QFrame { Q_OBJECT - Q_ENUMS(SizeAdjustPolicy) Q_PROPERTY(Qt::ScrollBarPolicy verticalScrollBarPolicy READ verticalScrollBarPolicy WRITE setVerticalScrollBarPolicy) Q_PROPERTY(Qt::ScrollBarPolicy horizontalScrollBarPolicy READ horizontalScrollBarPolicy WRITE setHorizontalScrollBarPolicy) Q_PROPERTY(SizeAdjustPolicy sizeAdjustPolicy READ sizeAdjustPolicy WRITE setSizeAdjustPolicy) @@ -63,6 +62,7 @@ public: AdjustToContentsOnFirstShow, AdjustToContents }; + Q_ENUM(SizeAdjustPolicy) Qt::ScrollBarPolicy verticalScrollBarPolicy() const; void setVerticalScrollBarPolicy(Qt::ScrollBarPolicy); diff --git a/src/widgets/widgets/qabstractspinbox.h b/src/widgets/widgets/qabstractspinbox.h index 8fcb5eadf0..234c06bb10 100644 --- a/src/widgets/widgets/qabstractspinbox.h +++ b/src/widgets/widgets/qabstractspinbox.h @@ -51,8 +51,6 @@ class Q_WIDGETS_EXPORT QAbstractSpinBox : public QWidget { Q_OBJECT - Q_ENUMS(ButtonSymbols) - Q_ENUMS(CorrectionMode) Q_PROPERTY(bool wrapping READ wrapping WRITE setWrapping) Q_PROPERTY(bool frame READ hasFrame WRITE setFrame) Q_PROPERTY(Qt::Alignment alignment READ alignment WRITE setAlignment) @@ -74,11 +72,13 @@ public: Q_DECLARE_FLAGS(StepEnabled, StepEnabledFlag) enum ButtonSymbols { UpDownArrows, PlusMinus, NoButtons }; + Q_ENUM(ButtonSymbols) ButtonSymbols buttonSymbols() const; void setButtonSymbols(ButtonSymbols bs); enum CorrectionMode { CorrectToPreviousValue, CorrectToNearestValue }; + Q_ENUM(CorrectionMode) void setCorrectionMode(CorrectionMode cm); CorrectionMode correctionMode() const; diff --git a/src/widgets/widgets/qcalendarwidget.h b/src/widgets/widgets/qcalendarwidget.h index f039fdf6c9..7914b13fba 100644 --- a/src/widgets/widgets/qcalendarwidget.h +++ b/src/widgets/widgets/qcalendarwidget.h @@ -50,9 +50,6 @@ class Q_WIDGETS_EXPORT QCalendarWidget : public QWidget { Q_OBJECT Q_ENUMS(Qt::DayOfWeek) - Q_ENUMS(HorizontalHeaderFormat) - Q_ENUMS(VerticalHeaderFormat) - Q_ENUMS(SelectionMode) Q_PROPERTY(QDate selectedDate READ selectedDate WRITE setSelectedDate) Q_PROPERTY(QDate minimumDate READ minimumDate WRITE setMinimumDate) Q_PROPERTY(QDate maximumDate READ maximumDate WRITE setMaximumDate) @@ -72,16 +69,19 @@ public: ShortDayNames, LongDayNames }; + Q_ENUM(HorizontalHeaderFormat) enum VerticalHeaderFormat { NoVerticalHeader, ISOWeekNumbers }; + Q_ENUM(VerticalHeaderFormat) enum SelectionMode { NoSelection, SingleSelection }; + Q_ENUM(SelectionMode) explicit QCalendarWidget(QWidget *parent = 0); ~QCalendarWidget(); diff --git a/src/widgets/widgets/qcombobox.h b/src/widgets/widgets/qcombobox.h index 7e399ec1f5..9c83d4dd08 100644 --- a/src/widgets/widgets/qcombobox.h +++ b/src/widgets/widgets/qcombobox.h @@ -52,8 +52,6 @@ class Q_WIDGETS_EXPORT QComboBox : public QWidget { Q_OBJECT - Q_ENUMS(InsertPolicy) - Q_ENUMS(SizeAdjustPolicy) Q_PROPERTY(bool editable READ isEditable WRITE setEditable) Q_PROPERTY(int count READ count) Q_PROPERTY(QString currentText READ currentText WRITE setCurrentText NOTIFY currentTextChanged USER true) @@ -115,6 +113,7 @@ public: InsertBeforeCurrent, InsertAlphabetically }; + Q_ENUM(InsertPolicy) InsertPolicy insertPolicy() const; void setInsertPolicy(InsertPolicy policy); @@ -125,6 +124,7 @@ public: AdjustToMinimumContentsLength, // ### Qt 6: remove AdjustToMinimumContentsLengthWithIcon }; + Q_ENUM(SizeAdjustPolicy) SizeAdjustPolicy sizeAdjustPolicy() const; void setSizeAdjustPolicy(SizeAdjustPolicy policy); diff --git a/src/widgets/widgets/qdatetimeedit.h b/src/widgets/widgets/qdatetimeedit.h index 5a1d6dbf3f..2d37bd4351 100644 --- a/src/widgets/widgets/qdatetimeedit.h +++ b/src/widgets/widgets/qdatetimeedit.h @@ -51,7 +51,6 @@ class Q_WIDGETS_EXPORT QDateTimeEdit : public QAbstractSpinBox { Q_OBJECT - Q_ENUMS(Section) Q_FLAGS(Sections) Q_PROPERTY(QDateTime dateTime READ dateTime WRITE setDateTime NOTIFY dateTimeChanged USER true) Q_PROPERTY(QDate date READ date WRITE setDate NOTIFY dateChanged) @@ -83,6 +82,7 @@ public: TimeSections_Mask = AmPmSection|MSecSection|SecondSection|MinuteSection|HourSection, DateSections_Mask = DaySection|MonthSection|YearSection }; + Q_ENUM(Section) Q_DECLARE_FLAGS(Sections, Section) diff --git a/src/widgets/widgets/qframe.h b/src/widgets/widgets/qframe.h index 90e434722e..41fd3a92b6 100644 --- a/src/widgets/widgets/qframe.h +++ b/src/widgets/widgets/qframe.h @@ -46,7 +46,6 @@ class Q_WIDGETS_EXPORT QFrame : public QWidget { Q_OBJECT - Q_ENUMS(Shape Shadow) Q_PROPERTY(Shape frameShape READ frameShape WRITE setFrameShape) Q_PROPERTY(Shadow frameShadow READ frameShadow WRITE setFrameShadow) Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth) @@ -74,11 +73,13 @@ public: VLine = 0x0005, // vertical line StyledPanel = 0x0006 // rectangular panel depending on the GUI style }; + Q_ENUM(Shape) enum Shadow { Plain = 0x0010, // plain line Raised = 0x0020, // raised shadow effect Sunken = 0x0030 // sunken shadow effect }; + Q_ENUM(Shadow) enum StyleMask { Shadow_Mask = 0x00f0, // mask for the shadow diff --git a/src/widgets/widgets/qlcdnumber.h b/src/widgets/widgets/qlcdnumber.h index 6acba3f7c1..59aad073f1 100644 --- a/src/widgets/widgets/qlcdnumber.h +++ b/src/widgets/widgets/qlcdnumber.h @@ -45,7 +45,6 @@ class QLCDNumberPrivate; class Q_WIDGETS_EXPORT QLCDNumber : public QFrame // LCD number widget { Q_OBJECT - Q_ENUMS(Mode SegmentStyle) Q_PROPERTY(bool smallDecimalPoint READ smallDecimalPoint WRITE setSmallDecimalPoint) Q_PROPERTY(int digitCount READ digitCount WRITE setDigitCount) Q_PROPERTY(Mode mode READ mode WRITE setMode) @@ -61,9 +60,11 @@ public: enum Mode { Hex, Dec, Oct, Bin }; + Q_ENUM(Mode) enum SegmentStyle { Outline, Filled, Flat }; + Q_ENUM(SegmentStyle) bool smallDecimalPoint() const; int digitCount() const; diff --git a/src/widgets/widgets/qlineedit.h b/src/widgets/widgets/qlineedit.h index bfbf9fe670..c1e873f02a 100644 --- a/src/widgets/widgets/qlineedit.h +++ b/src/widgets/widgets/qlineedit.h @@ -58,7 +58,6 @@ class Q_WIDGETS_EXPORT QLineEdit : public QWidget { Q_OBJECT - Q_ENUMS(ActionPosition EchoMode) Q_PROPERTY(QString inputMask READ inputMask WRITE setInputMask) Q_PROPERTY(QString text READ text WRITE setText NOTIFY textChanged USER true) Q_PROPERTY(int maxLength READ maxLength WRITE setMaxLength) @@ -83,6 +82,7 @@ public: LeadingPosition, TrailingPosition }; + Q_ENUM(ActionPosition) explicit QLineEdit(QWidget* parent=0); explicit QLineEdit(const QString &, QWidget* parent=0); @@ -105,6 +105,7 @@ public: bool isClearButtonEnabled() const; enum EchoMode { Normal, NoEcho, Password, PasswordEchoOnEdit }; + Q_ENUM(EchoMode) EchoMode echoMode() const; void setEchoMode(EchoMode); diff --git a/src/widgets/widgets/qmainwindow.h b/src/widgets/widgets/qmainwindow.h index 717bc32739..a1f7df2f4e 100644 --- a/src/widgets/widgets/qmainwindow.h +++ b/src/widgets/widgets/qmainwindow.h @@ -53,7 +53,6 @@ class Q_WIDGETS_EXPORT QMainWindow : public QWidget { Q_OBJECT - Q_ENUMS(DockOption) Q_FLAGS(DockOptions) Q_PROPERTY(QSize iconSize READ iconSize WRITE setIconSize) Q_PROPERTY(Qt::ToolButtonStyle toolButtonStyle READ toolButtonStyle WRITE setToolButtonStyle) @@ -80,6 +79,7 @@ public: ForceTabbedDocks = 0x08, // implies AllowTabbedDocks, !AllowNestedDocks VerticalTabs = 0x10 // implies AllowTabbedDocks }; + Q_ENUM(DockOption) Q_DECLARE_FLAGS(DockOptions, DockOption) explicit QMainWindow(QWidget *parent = 0, Qt::WindowFlags flags = 0); diff --git a/src/widgets/widgets/qmdiarea.h b/src/widgets/widgets/qmdiarea.h index b824cfb4ae..19deabddf8 100644 --- a/src/widgets/widgets/qmdiarea.h +++ b/src/widgets/widgets/qmdiarea.h @@ -48,7 +48,6 @@ class QMdiAreaPrivate; class Q_WIDGETS_EXPORT QMdiArea : public QAbstractScrollArea { Q_OBJECT - Q_ENUMS(ViewMode) Q_PROPERTY(QBrush background READ background WRITE setBackground) Q_PROPERTY(WindowOrder activationOrder READ activationOrder WRITE setActivationOrder) Q_PROPERTY(ViewMode viewMode READ viewMode WRITE setViewMode) @@ -61,7 +60,6 @@ class Q_WIDGETS_EXPORT QMdiArea : public QAbstractScrollArea Q_PROPERTY(QTabWidget::TabShape tabShape READ tabShape WRITE setTabShape) Q_PROPERTY(QTabWidget::TabPosition tabPosition READ tabPosition WRITE setTabPosition) #endif - Q_ENUMS(WindowOrder) public: enum AreaOption { DontMaximizeSubWindowOnActivation = 0x1 @@ -73,11 +71,13 @@ public: StackingOrder, ActivationHistoryOrder }; + Q_ENUM(WindowOrder) enum ViewMode { SubWindowView, TabbedView }; + Q_ENUM(ViewMode) QMdiArea(QWidget *parent = 0); ~QMdiArea(); diff --git a/src/widgets/widgets/qplaintextedit.h b/src/widgets/widgets/qplaintextedit.h index c47da891c8..bb9ecc9886 100644 --- a/src/widgets/widgets/qplaintextedit.h +++ b/src/widgets/widgets/qplaintextedit.h @@ -59,7 +59,6 @@ class Q_WIDGETS_EXPORT QPlainTextEdit : public QAbstractScrollArea { Q_OBJECT Q_DECLARE_PRIVATE(QPlainTextEdit) - Q_ENUMS(LineWrapMode) Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus) Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle) Q_PROPERTY(bool undoRedoEnabled READ isUndoRedoEnabled WRITE setUndoRedoEnabled) @@ -81,6 +80,7 @@ public: NoWrap, WidgetWidth }; + Q_ENUM(LineWrapMode) explicit QPlainTextEdit(QWidget *parent = 0); explicit QPlainTextEdit(const QString &text, QWidget *parent = 0); diff --git a/src/widgets/widgets/qprogressbar.h b/src/widgets/widgets/qprogressbar.h index 898656f8f4..7e1a04bd7b 100644 --- a/src/widgets/widgets/qprogressbar.h +++ b/src/widgets/widgets/qprogressbar.h @@ -47,7 +47,6 @@ class QStyleOptionProgressBar; class Q_WIDGETS_EXPORT QProgressBar : public QWidget { Q_OBJECT - Q_ENUMS(Direction) Q_PROPERTY(int minimum READ minimum WRITE setMinimum) Q_PROPERTY(int maximum READ maximum WRITE setMaximum) Q_PROPERTY(QString text READ text) @@ -61,6 +60,7 @@ class Q_WIDGETS_EXPORT QProgressBar : public QWidget public: enum Direction { TopToBottom, BottomToTop }; + Q_ENUM(Direction) explicit QProgressBar(QWidget *parent = 0); ~QProgressBar(); diff --git a/src/widgets/widgets/qslider.h b/src/widgets/widgets/qslider.h index 66b23e6fa3..6191e7fcab 100644 --- a/src/widgets/widgets/qslider.h +++ b/src/widgets/widgets/qslider.h @@ -47,7 +47,6 @@ class Q_WIDGETS_EXPORT QSlider : public QAbstractSlider { Q_OBJECT - Q_ENUMS(TickPosition) Q_PROPERTY(TickPosition tickPosition READ tickPosition WRITE setTickPosition) Q_PROPERTY(int tickInterval READ tickInterval WRITE setTickInterval) @@ -60,6 +59,7 @@ public: TicksRight = TicksBelow, TicksBothSides = 3 }; + Q_ENUM(TickPosition) explicit QSlider(QWidget *parent = 0); explicit QSlider(Qt::Orientation orientation, QWidget *parent = 0); diff --git a/src/widgets/widgets/qtabbar.h b/src/widgets/widgets/qtabbar.h index 5cca289020..70cb02eb72 100644 --- a/src/widgets/widgets/qtabbar.h +++ b/src/widgets/widgets/qtabbar.h @@ -49,7 +49,6 @@ class Q_WIDGETS_EXPORT QTabBar: public QWidget { Q_OBJECT - Q_ENUMS(Shape) Q_PROPERTY(Shape shape READ shape WRITE setShape) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) Q_PROPERTY(int count READ count) @@ -72,6 +71,7 @@ public: enum Shape { RoundedNorth, RoundedSouth, RoundedWest, RoundedEast, TriangularNorth, TriangularSouth, TriangularWest, TriangularEast }; + Q_ENUM(Shape) enum ButtonPosition { LeftSide, diff --git a/src/widgets/widgets/qtabwidget.h b/src/widgets/widgets/qtabwidget.h index dc5c49c99c..4913a2197a 100644 --- a/src/widgets/widgets/qtabwidget.h +++ b/src/widgets/widgets/qtabwidget.h @@ -49,7 +49,6 @@ class QStyleOptionTabWidgetFrame; class Q_WIDGETS_EXPORT QTabWidget : public QWidget { Q_OBJECT - Q_ENUMS(TabPosition TabShape) Q_PROPERTY(TabPosition tabPosition READ tabPosition WRITE setTabPosition) Q_PROPERTY(TabShape tabShape READ tabShape WRITE setTabShape) Q_PROPERTY(int currentIndex READ currentIndex WRITE setCurrentIndex NOTIFY currentChanged) @@ -100,6 +99,7 @@ public: int count() const; enum TabPosition { North, South, West, East }; + Q_ENUM(TabPosition) TabPosition tabPosition() const; void setTabPosition(TabPosition); @@ -110,6 +110,7 @@ public: void setMovable(bool movable); enum TabShape { Rounded, Triangular }; + Q_ENUM(TabShape) TabShape tabShape() const; void setTabShape(TabShape s); diff --git a/src/widgets/widgets/qtextedit.h b/src/widgets/widgets/qtextedit.h index 4c5af67cca..30533b7435 100644 --- a/src/widgets/widgets/qtextedit.h +++ b/src/widgets/widgets/qtextedit.h @@ -58,7 +58,6 @@ class Q_WIDGETS_EXPORT QTextEdit : public QAbstractScrollArea Q_OBJECT Q_DECLARE_PRIVATE(QTextEdit) Q_FLAGS(AutoFormatting) - Q_ENUMS(LineWrapMode) Q_PROPERTY(AutoFormatting autoFormatting READ autoFormatting WRITE setAutoFormatting) Q_PROPERTY(bool tabChangesFocus READ tabChangesFocus WRITE setTabChangesFocus) Q_PROPERTY(QString documentTitle READ documentTitle WRITE setDocumentTitle) @@ -85,6 +84,7 @@ public: FixedPixelWidth, FixedColumnWidth }; + Q_ENUM(LineWrapMode) enum AutoFormattingFlag { AutoNone = 0, diff --git a/src/widgets/widgets/qtoolbutton.h b/src/widgets/widgets/qtoolbutton.h index 5301a8b22b..fdd32c7486 100644 --- a/src/widgets/widgets/qtoolbutton.h +++ b/src/widgets/widgets/qtoolbutton.h @@ -48,7 +48,7 @@ class QStyleOptionToolButton; class Q_WIDGETS_EXPORT QToolButton : public QAbstractButton { Q_OBJECT - Q_ENUMS(Qt::ToolButtonStyle Qt::ArrowType ToolButtonPopupMode) + Q_ENUMS(Qt::ToolButtonStyle Qt::ArrowType) #ifndef QT_NO_MENU Q_PROPERTY(ToolButtonPopupMode popupMode READ popupMode WRITE setPopupMode) #endif @@ -62,6 +62,7 @@ public: MenuButtonPopup, InstantPopup }; + Q_ENUM(ToolButtonPopupMode) explicit QToolButton(QWidget * parent=0); ~QToolButton(); -- cgit v1.2.3