Flip Q_ENUMS to Q_ENUM

See https://woboq.com/blog/q_enum.html for rationale
This commit is contained in:
Nyall Dawson 2017-08-29 16:22:20 +10:00
parent 51170aec0c
commit 1fddfcf622
18 changed files with 25 additions and 20 deletions

View File

@ -52,6 +52,7 @@ class QgsDataItem : QObject
Project
};
QgsDataItem( QgsDataItem::Type type, QgsDataItem *parent /TransferThis/, const QString &name, const QString &path );
%Docstring
Create new data item.

View File

@ -46,7 +46,6 @@ class QgsDataProvider : QObject
%End
public:
enum DataCapability
{
NoDataCapabilities,

View File

@ -34,6 +34,7 @@ class QgsDualView : QStackedWidget
AttributeEditor
};
explicit QgsDualView( QWidget *parent /TransferThis/ = 0 );
%Docstring
Constructor

View File

@ -31,13 +31,13 @@ class QgsFontButton : QToolButton
%End
public:
enum Mode
{
ModeTextRenderer,
ModeQFont,
};
QgsFontButton( QWidget *parent /TransferThis/ = 0, const QString &dialogTitle = QString() );
%Docstring
Construct a new font button.

View File

@ -464,7 +464,7 @@ while ($LINE_IDX < $LINE_COUNT){
next;
}
# Skip Q_OBJECT, Q_PROPERTY, Q_ENUM, Q_GADGET etc.
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED|NOWARN_DEPRECATED_(PUSH|POP)).*?$/){
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|ENUM|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED|NOWARN_DEPRECATED_(PUSH|POP)).*?$/){
next;
}

View File

@ -60,7 +60,6 @@ class QTimer;
class CORE_EXPORT QgsAuthManager : public QObject
{
Q_OBJECT
Q_ENUMS( MessageLevel )
public:
@ -71,6 +70,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
WARNING = 1,
CRITICAL = 2
};
Q_ENUM( MessageLevel );
/** Enforce singleton pattern
* \note To set up the manager instance and initialize everything use QgsAuthManager::instance()->init()

View File

@ -146,7 +146,6 @@ void QgsApplication::init( QString profileFolder )
qRegisterMetaType<QgsGeometry::Error>( "QgsGeometry::Error" );
qRegisterMetaType<QgsProcessingFeatureSourceDefinition>( "QgsProcessingFeatureSourceDefinition" );
qRegisterMetaType<QgsProcessingOutputLayerDefinition>( "QgsProcessingOutputLayerDefinition" );
qRegisterMetaType<QgsUnitTypes::LayoutUnit>( "QgsUnitTypes::LayoutUnit" );
qRegisterMetaType<QgsFeatureIds>( "QgsFeatureIds" );
QString prefixPath( getenv( "QGIS_PREFIX_PATH" ) ? getenv( "QGIS_PREFIX_PATH" ) : applicationDirPath() );

View File

@ -69,8 +69,7 @@ class CORE_EXPORT QgsDataItem : public QObject
#endif
Q_OBJECT
Q_ENUMS( Type )
Q_ENUMS( State )
public:
enum Type
{
@ -82,6 +81,8 @@ class CORE_EXPORT QgsDataItem : public QObject
Project //!< Represents a QGIS project
};
Q_ENUM( Type );
//! Create new data item.
QgsDataItem( QgsDataItem::Type type, QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &path );
virtual ~QgsDataItem();
@ -100,6 +101,7 @@ class CORE_EXPORT QgsDataItem : public QObject
Populating, //!< Creating children in separate thread (populating or refreshing)
Populated //!< Children created
};
Q_ENUM( State );
//! \since QGIS 2.8
State state() const;
@ -328,7 +330,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( QgsDataItem::Capabilities )
class CORE_EXPORT QgsLayerItem : public QgsDataItem
{
Q_OBJECT
Q_ENUMS( LayerType )
public:
enum LayerType
{
@ -344,7 +346,7 @@ class CORE_EXPORT QgsLayerItem : public QgsDataItem
Plugin //!< Added in 2.10
};
Q_ENUMS( LayerType )
Q_ENUM( LayerType );
QgsLayerItem( QgsDataItem *parent, const QString &name, const QString &path, const QString &uri, LayerType layerType, const QString &providerKey );

View File

@ -67,8 +67,6 @@ class CORE_EXPORT QgsDataProvider : public QObject
public:
Q_ENUMS( DataCapability )
enum DataCapability
{
NoDataCapabilities = 0,
@ -77,6 +75,7 @@ class CORE_EXPORT QgsDataProvider : public QObject
Database = 1 << 2,
Net = 1 << 3 // Internet source
};
Q_ENUM( DataCapability );
/**
* Properties are used to pass custom configuration options into data providers.

View File

@ -25,7 +25,6 @@ class QgsMessageLogConsole;
QgsMessageLog::QgsMessageLog()
: QObject()
{
qRegisterMetaType< QgsMessageLog::MessageLevel >( "QgsMessageLog::MessageLevel" );
}
void QgsMessageLog::logMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level )

View File

@ -36,7 +36,6 @@
class CORE_EXPORT QgsMessageLog : public QObject
{
Q_OBJECT
Q_ENUMS( MessageLevel )
public:
@ -48,6 +47,7 @@ class CORE_EXPORT QgsMessageLog : public QObject
CRITICAL = 2,
NONE = 3
};
Q_ENUM( MessageLevel );
QgsMessageLog();

View File

@ -52,6 +52,7 @@ class CORE_EXPORT QgsUnitTypes
DistanceMillimeters, //!< Millimeters
DistanceUnknownUnit, //!< Unknown distance unit
};
Q_ENUM( DistanceUnit );
/** Types of distance units
*/
@ -78,6 +79,7 @@ class CORE_EXPORT QgsUnitTypes
AreaSquareMillimeters, //! Square millimeters
AreaUnknownUnit, //!< Unknown areal unit
};
Q_ENUM( AreaUnit );
//! Units of angles
enum AngleUnit
@ -90,6 +92,7 @@ class CORE_EXPORT QgsUnitTypes
AngleTurn, //!< Turn/revolutions
AngleUnknownUnit, //!< Unknown angle unit
};
Q_ENUM( AngleUnit );
//! Rendering size units
enum RenderUnit
@ -103,6 +106,7 @@ class CORE_EXPORT QgsUnitTypes
RenderUnknownUnit, //!< Mixed or unknown units
RenderMetersInMapUnits, //!< Meters value as Map units
};
Q_ENUM( RenderUnit );
//! Layout measurement units
enum LayoutUnit
@ -116,6 +120,7 @@ class CORE_EXPORT QgsUnitTypes
LayoutPicas, //!< Typographic picas
LayoutPixels //!< Pixels
};
Q_ENUM( LayoutUnit );
//! Types of layout units
enum LayoutUnitType

View File

@ -42,7 +42,6 @@ class QgsScrollArea;
class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBase
{
Q_OBJECT
Q_ENUMS( ViewMode )
public:
@ -67,6 +66,8 @@ class GUI_EXPORT QgsDualView : public QStackedWidget, private Ui::QgsDualViewBas
AttributeEditor = 1
};
Q_ENUM( ViewMode );
/**
* \brief Constructor
* \param parent The parent widget

View File

@ -46,7 +46,6 @@ class GUI_EXPORT QgsColorButton : public QToolButton
Q_OBJECT
Q_ENUMS( Behavior )
Q_PROPERTY( QString colorDialogTitle READ colorDialogTitle WRITE setColorDialogTitle )
Q_PROPERTY( bool acceptLiveUpdates READ acceptLiveUpdates WRITE setAcceptLiveUpdates )
Q_PROPERTY( QColor color READ color WRITE setColor )
@ -67,6 +66,7 @@ class GUI_EXPORT QgsColorButton : public QToolButton
ShowDialog = 0, //!< Show a color picker dialog when clicked
SignalOnly //!< Emit colorClicked signal only, no dialog
};
Q_ENUM( Behavior );
/** Construct a new color ramp button.
* Use \a parent to attach a parent QWidget to the dialog.

View File

@ -47,7 +47,6 @@ class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
#endif
Q_OBJECT
Q_ENUMS( ClearMode )
Q_PROPERTY( ClearMode clearMode READ clearMode WRITE setClearMode )
Q_PROPERTY( QString nullValue READ nullValue WRITE setNullValue )
Q_PROPERTY( QString defaultValue READ defaultValue WRITE setDefaultValue )
@ -63,6 +62,7 @@ class GUI_EXPORT QgsFilterLineEdit : public QLineEdit
ClearToNull = 0, //!< Reset value to null
ClearToDefault, //!< Reset value to default value (see defaultValue() )
};
Q_ENUM( ClearMode );
/** Constructor for QgsFilterLineEdit.
* \param parent parent widget

View File

@ -32,7 +32,6 @@ class QgsFloatingWidgetEventFilter;
class GUI_EXPORT QgsFloatingWidget: public QWidget
{
Q_OBJECT
Q_ENUMS( AnchorPoint )
Q_PROPERTY( QWidget *anchorWidget READ anchorWidget WRITE setAnchorWidget NOTIFY anchorWidgetChanged )
Q_PROPERTY( AnchorPoint anchorPoint READ anchorPoint WRITE setAnchorPoint NOTIFY anchorPointChanged )
Q_PROPERTY( AnchorPoint anchorWidgetPoint READ anchorWidgetPoint WRITE setAnchorWidgetPoint NOTIFY anchorWidgetPointChanged )
@ -52,6 +51,7 @@ class GUI_EXPORT QgsFloatingWidget: public QWidget
BottomMiddle, //!< Bottom center of widget
BottomRight, //!< Bottom-right of widget
};
Q_ENUM( AnchorPoint );
/** Constructor for QgsFloatingWidget.
* \param parent parent widget

View File

@ -50,8 +50,6 @@ class GUI_EXPORT QgsFontButton : public QToolButton
public:
Q_ENUMS( Mode )
//! Available button modes.
enum Mode
{
@ -59,6 +57,8 @@ class GUI_EXPORT QgsFontButton : public QToolButton
ModeQFont, //!< Configure font settings for use with QFont objects
};
Q_ENUM( Mode );
/**
* Construct a new font button.
* Use \a parent to attach a parent QWidget to the dialog.

View File

@ -25,7 +25,6 @@ Email : nyall dot dawson at gmail dot com
Q_DECLARE_METATYPE( QgsRasterCalcNode::Operator )
class TestQgsRasterCalculator : public QObject
{
Q_OBJECT