Skip to content

Commit 1fddfcf

Browse files
committed
Flip Q_ENUMS to Q_ENUM
See https://woboq.com/blog/q_enum.html for rationale
1 parent 51170ae commit 1fddfcf

18 files changed

+25
-20
lines changed

python/core/qgsdataitem.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ class QgsDataItem : QObject
5252
Project
5353
};
5454

55+
5556
QgsDataItem( QgsDataItem::Type type, QgsDataItem *parent /TransferThis/, const QString &name, const QString &path );
5657
%Docstring
5758
Create new data item.

python/core/qgsdataprovider.sip

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ class QgsDataProvider : QObject
4646
%End
4747
public:
4848

49-
5049
enum DataCapability
5150
{
5251
NoDataCapabilities,

python/gui/attributetable/qgsdualview.sip

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ class QgsDualView : QStackedWidget
3434
AttributeEditor
3535
};
3636

37+
3738
explicit QgsDualView( QWidget *parent /TransferThis/ = 0 );
3839
%Docstring
3940
Constructor

python/gui/qgsfontbutton.sip

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,13 +31,13 @@ class QgsFontButton : QToolButton
3131
%End
3232
public:
3333

34-
3534
enum Mode
3635
{
3736
ModeTextRenderer,
3837
ModeQFont,
3938
};
4039

40+
4141
QgsFontButton( QWidget *parent /TransferThis/ = 0, const QString &dialogTitle = QString() );
4242
%Docstring
4343
Construct a new font button.

scripts/sipify.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -464,7 +464,7 @@ sub detect_comment_block{
464464
next;
465465
}
466466
# Skip Q_OBJECT, Q_PROPERTY, Q_ENUM, Q_GADGET etc.
467-
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED|NOWARN_DEPRECATED_(PUSH|POP)).*?$/){
467+
if ($LINE =~ m/^\s*Q_(OBJECT|ENUMS|ENUM|PROPERTY|GADGET|DECLARE_METATYPE|DECLARE_TYPEINFO|DECL_DEPRECATED|NOWARN_DEPRECATED_(PUSH|POP)).*?$/){
468468
next;
469469
}
470470

src/core/auth/qgsauthmanager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@ class QTimer;
6060
class CORE_EXPORT QgsAuthManager : public QObject
6161
{
6262
Q_OBJECT
63-
Q_ENUMS( MessageLevel )
6463

6564
public:
6665

@@ -71,6 +70,7 @@ class CORE_EXPORT QgsAuthManager : public QObject
7170
WARNING = 1,
7271
CRITICAL = 2
7372
};
73+
Q_ENUM( MessageLevel );
7474

7575
/** Enforce singleton pattern
7676
* \note To set up the manager instance and initialize everything use QgsAuthManager::instance()->init()

src/core/qgsapplication.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,6 @@ void QgsApplication::init( QString profileFolder )
146146
qRegisterMetaType<QgsGeometry::Error>( "QgsGeometry::Error" );
147147
qRegisterMetaType<QgsProcessingFeatureSourceDefinition>( "QgsProcessingFeatureSourceDefinition" );
148148
qRegisterMetaType<QgsProcessingOutputLayerDefinition>( "QgsProcessingOutputLayerDefinition" );
149-
qRegisterMetaType<QgsUnitTypes::LayoutUnit>( "QgsUnitTypes::LayoutUnit" );
150149
qRegisterMetaType<QgsFeatureIds>( "QgsFeatureIds" );
151150

152151
QString prefixPath( getenv( "QGIS_PREFIX_PATH" ) ? getenv( "QGIS_PREFIX_PATH" ) : applicationDirPath() );

src/core/qgsdataitem.h

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,7 @@ class CORE_EXPORT QgsDataItem : public QObject
6969
#endif
7070

7171
Q_OBJECT
72-
Q_ENUMS( Type )
73-
Q_ENUMS( State )
72+
7473
public:
7574
enum Type
7675
{
@@ -82,6 +81,8 @@ class CORE_EXPORT QgsDataItem : public QObject
8281
Project //!< Represents a QGIS project
8382
};
8483

84+
Q_ENUM( Type );
85+
8586
//! Create new data item.
8687
QgsDataItem( QgsDataItem::Type type, QgsDataItem *parent SIP_TRANSFERTHIS, const QString &name, const QString &path );
8788
virtual ~QgsDataItem();
@@ -100,6 +101,7 @@ class CORE_EXPORT QgsDataItem : public QObject
100101
Populating, //!< Creating children in separate thread (populating or refreshing)
101102
Populated //!< Children created
102103
};
104+
Q_ENUM( State );
103105

104106
//! \since QGIS 2.8
105107
State state() const;
@@ -328,7 +330,7 @@ Q_DECLARE_OPERATORS_FOR_FLAGS( QgsDataItem::Capabilities )
328330
class CORE_EXPORT QgsLayerItem : public QgsDataItem
329331
{
330332
Q_OBJECT
331-
Q_ENUMS( LayerType )
333+
332334
public:
333335
enum LayerType
334336
{
@@ -344,7 +346,7 @@ class CORE_EXPORT QgsLayerItem : public QgsDataItem
344346
Plugin //!< Added in 2.10
345347
};
346348

347-
Q_ENUMS( LayerType )
349+
Q_ENUM( LayerType );
348350

349351
QgsLayerItem( QgsDataItem *parent, const QString &name, const QString &path, const QString &uri, LayerType layerType, const QString &providerKey );
350352

src/core/qgsdataprovider.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,6 @@ class CORE_EXPORT QgsDataProvider : public QObject
6767

6868
public:
6969

70-
Q_ENUMS( DataCapability )
71-
7270
enum DataCapability
7371
{
7472
NoDataCapabilities = 0,
@@ -77,6 +75,7 @@ class CORE_EXPORT QgsDataProvider : public QObject
7775
Database = 1 << 2,
7876
Net = 1 << 3 // Internet source
7977
};
78+
Q_ENUM( DataCapability );
8079

8180
/**
8281
* Properties are used to pass custom configuration options into data providers.

src/core/qgsmessagelog.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ class QgsMessageLogConsole;
2525
QgsMessageLog::QgsMessageLog()
2626
: QObject()
2727
{
28-
qRegisterMetaType< QgsMessageLog::MessageLevel >( "QgsMessageLog::MessageLevel" );
2928
}
3029

3130
void QgsMessageLog::logMessage( const QString &message, const QString &tag, QgsMessageLog::MessageLevel level )

0 commit comments

Comments
 (0)