Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
more flag operators declaration in SIP, better use of flags in data d…
…efined button
  • Loading branch information
3nids committed Sep 1, 2014
1 parent 8a65115 commit 5b1a516
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 6 deletions.
4 changes: 3 additions & 1 deletion python/gui/qgsdatadefinedbutton.sip
Expand Up @@ -6,10 +6,10 @@ class QgsDataDefinedButton : QToolButton
public:
enum DataType
{
AnyType,
String,
Int,
Double,
AnyType
};
typedef QFlags<QgsDataDefinedButton::DataType> DataTypes;

Expand Down Expand Up @@ -207,3 +207,5 @@ class QgsDataDefinedButton : QToolButton
void setField( QString field );

};

QFlags<QgsDataDefinedButton::DataType> operator|(QgsDataDefinedButton::DataType f1, QFlags<QgsDataDefinedButton::DataType> f2);
2 changes: 2 additions & 0 deletions python/gui/qgsfieldproxymodel.sip
Expand Up @@ -45,3 +45,5 @@ class QgsFieldProxyModel : QSortFilterProxyModel
bool lessThan( const QModelIndex &left, const QModelIndex &right ) const;
};

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

2 changes: 2 additions & 0 deletions python/gui/qgsmaplayeractionregistry.sip
Expand Up @@ -45,6 +45,8 @@ class QgsMapLayerAction : QAction

};

QFlags<QgsMapLayerAction::Target> operator|(QgsMapLayerAction::Target f1, QFlags<QgsMapLayerAction::Target> f2);

class QgsMapLayerActionRegistry : QObject
{
%TypeHeaderCode
Expand Down
6 changes: 3 additions & 3 deletions src/gui/qgsdatadefinedbutton.cpp
Expand Up @@ -131,15 +131,15 @@ void QgsDataDefinedButton::init( const QgsVectorLayer* vl,
mDataTypesString = QString( "" );

QStringList ts;
if ( mDataTypes.testFlag( AnyType ) || mDataTypes.testFlag( String ) )
if ( mDataTypes.testFlag( String ) )
{
ts << tr( "string" );
}
if ( mDataTypes.testFlag( AnyType ) || mDataTypes.testFlag( Int ) )
if ( mDataTypes.testFlag( Int ) )
{
ts << tr( "int" );
}
if ( mDataTypes.testFlag( AnyType ) || mDataTypes.testFlag( Double ) )
if ( mDataTypes.testFlag( Double ) )
{
ts << tr( "double" );
}
Expand Down
4 changes: 2 additions & 2 deletions src/gui/qgsdatadefinedbutton.h
Expand Up @@ -39,10 +39,10 @@ class GUI_EXPORT QgsDataDefinedButton: public QToolButton
public:
enum DataType
{
AnyType = 0,
String = 1,
Int = 2,
Double = 4
Double = 4,
AnyType = String | Int | Double
};
Q_DECLARE_FLAGS( DataTypes, DataType )

Expand Down

0 comments on commit 5b1a516

Please sign in to comment.