Skip to content

Commit 5b1a516

Browse files
committed
more flag operators declaration in SIP, better use of flags in data defined button
1 parent 8a65115 commit 5b1a516

File tree

5 files changed

+12
-6
lines changed

5 files changed

+12
-6
lines changed

python/gui/qgsdatadefinedbutton.sip

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ class QgsDataDefinedButton : QToolButton
66
public:
77
enum DataType
88
{
9-
AnyType,
109
String,
1110
Int,
1211
Double,
12+
AnyType
1313
};
1414
typedef QFlags<QgsDataDefinedButton::DataType> DataTypes;
1515

@@ -207,3 +207,5 @@ class QgsDataDefinedButton : QToolButton
207207
void setField( QString field );
208208

209209
};
210+
211+
QFlags<QgsDataDefinedButton::DataType> operator|(QgsDataDefinedButton::DataType f1, QFlags<QgsDataDefinedButton::DataType> f2);

python/gui/qgsfieldproxymodel.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,5 @@ class QgsFieldProxyModel : QSortFilterProxyModel
4545
bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
4646
};
4747

48+
QFlags<QgsFieldProxyModel::Filter> operator|(QgsFieldProxyModel::Filter f1, QFlags<QgsFieldProxyModel::Filter> f2);
49+

python/gui/qgsmaplayeractionregistry.sip

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ class QgsMapLayerAction : QAction
4545

4646
};
4747

48+
QFlags<QgsMapLayerAction::Target> operator|(QgsMapLayerAction::Target f1, QFlags<QgsMapLayerAction::Target> f2);
49+
4850
class QgsMapLayerActionRegistry : QObject
4951
{
5052
%TypeHeaderCode

src/gui/qgsdatadefinedbutton.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,15 +131,15 @@ void QgsDataDefinedButton::init( const QgsVectorLayer* vl,
131131
mDataTypesString = QString( "" );
132132

133133
QStringList ts;
134-
if ( mDataTypes.testFlag( AnyType ) || mDataTypes.testFlag( String ) )
134+
if ( mDataTypes.testFlag( String ) )
135135
{
136136
ts << tr( "string" );
137137
}
138-
if ( mDataTypes.testFlag( AnyType ) || mDataTypes.testFlag( Int ) )
138+
if ( mDataTypes.testFlag( Int ) )
139139
{
140140
ts << tr( "int" );
141141
}
142-
if ( mDataTypes.testFlag( AnyType ) || mDataTypes.testFlag( Double ) )
142+
if ( mDataTypes.testFlag( Double ) )
143143
{
144144
ts << tr( "double" );
145145
}

src/gui/qgsdatadefinedbutton.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,10 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton
3939
public:
4040
enum DataType
4141
{
42-
AnyType = 0,
4342
String = 1,
4443
Int = 2,
45-
Double = 4
44+
Double = 4,
45+
AnyType = String | Int | Double
4646
};
4747
Q_DECLARE_FLAGS( DataTypes, DataType )
4848

0 commit comments

Comments
 (0)