2017-01-18 11:35:45 +10:00
|
|
|
typedef QMap< int, QgsPropertyDefinition > QgsPropertiesDefinition;
|
2017-01-10 19:35:19 +10:00
|
|
|
|
2017-01-04 07:16:44 +10:00
|
|
|
class QgsAbstractPropertyCollection
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgspropertycollection.h>
|
|
|
|
%End
|
2017-01-10 12:34:08 +10:00
|
|
|
|
|
|
|
%ConvertToSubClassCode
|
|
|
|
if ( dynamic_cast<QgsPropertyCollection*>(sipCpp) )
|
|
|
|
sipType = sipType_QgsPropertyCollection;
|
|
|
|
else if ( dynamic_cast<QgsPropertyCollectionStack*>(sipCpp) )
|
|
|
|
sipType = sipType_QgsPropertyCollectionStack;
|
|
|
|
else
|
|
|
|
sipType = sipType_QgsAbstractPropertyCollection;
|
|
|
|
%End
|
|
|
|
|
2017-01-04 07:16:44 +10:00
|
|
|
public:
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsAbstractPropertyCollection( const QString &name = QString() );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
QString name() const;
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setName( const QString &name );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
virtual QSet<int> propertyKeys() const = 0;
|
|
|
|
|
|
|
|
virtual void clear() = 0;
|
|
|
|
|
|
|
|
virtual bool hasProperty( int key ) const = 0;
|
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
virtual QgsProperty property( int key ) const = 0;
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual QVariant value( int key, const QgsExpressionContext &context, const QVariant &defaultValue = QVariant() ) const = 0;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QString valueAsString( int key, const QgsExpressionContext &context, const QString &defaultString = QString(), bool *ok /Out/ = nullptr ) const;
|
2017-01-11 10:36:51 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QColor valueAsColor( int key, const QgsExpressionContext &context, const QColor &defaultColor = QColor(), bool *ok /Out/ = nullptr ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
double valueAsDouble( int key, const QgsExpressionContext &context, double defaultValue = 0.0, bool *ok /Out/ = nullptr ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
int valueAsInt( int key, const QgsExpressionContext &context, int defaultValue = 0, bool *ok /Out/ = nullptr ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool valueAsBool( int key, const QgsExpressionContext &context, bool defaultValue = false, bool *ok /Out/ = nullptr ) const;
|
2017-01-10 19:35:19 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual bool prepare( const QgsExpressionContext &context = QgsExpressionContext() ) const = 0;
|
2017-01-10 13:33:17 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const = 0;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
virtual bool isActive( int key ) const = 0;
|
|
|
|
|
|
|
|
virtual bool hasActiveProperties() const = 0;
|
|
|
|
|
2017-01-20 07:45:11 +10:00
|
|
|
virtual bool hasDynamicProperties() const = 0;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
virtual bool writeXml( QDomElement &collectionElem, const QgsPropertiesDefinition &definitions ) const = 0;
|
|
|
|
virtual bool readXml( const QDomElement &collectionElem, const QgsPropertiesDefinition &definitions ) = 0;
|
2017-03-09 09:46:06 +01:00
|
|
|
virtual QVariant toVariant( const QgsPropertiesDefinition &definitions ) const = 0;
|
|
|
|
virtual bool loadVariant( const QVariant &configuration, const QgsPropertiesDefinition &definitions ) = 0;
|
2017-01-04 07:16:44 +10:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class QgsPropertyCollection : QgsAbstractPropertyCollection
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgspropertycollection.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsPropertyCollection( const QString &name = QString() );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
~QgsPropertyCollection();
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsPropertyCollection( const QgsPropertyCollection &other );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
//QgsPropertyCollection &operator=( const QgsPropertyCollection &other );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
int count() const;
|
|
|
|
|
|
|
|
QSet<int> propertyKeys() const;
|
|
|
|
void clear();
|
|
|
|
bool hasProperty( int key ) const;
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsProperty &property( int key );
|
|
|
|
QVariant value( int key, const QgsExpressionContext &context, const QVariant &defaultValue = QVariant() ) const;
|
|
|
|
bool prepare( const QgsExpressionContext &context = QgsExpressionContext() ) const;
|
|
|
|
QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
bool isActive( int key ) const;
|
|
|
|
bool hasActiveProperties() const;
|
2017-01-20 07:45:11 +10:00
|
|
|
bool hasDynamicProperties() const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-03-09 09:46:06 +01:00
|
|
|
QVariant toVariant( const QgsPropertiesDefinition &definitions ) const;
|
|
|
|
bool loadVariant( const QVariant &configuration, const QgsPropertiesDefinition &definitions );
|
2017-05-01 16:42:33 +02:00
|
|
|
void setProperty( int key, const QgsProperty &property );
|
2017-01-18 22:47:55 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
void setProperty( int key, const QVariant &value );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
class QgsPropertyCollectionStack : QgsAbstractPropertyCollection
|
|
|
|
{
|
|
|
|
%TypeHeaderCode
|
|
|
|
#include <qgspropertycollection.h>
|
|
|
|
%End
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
|
|
|
QgsPropertyCollectionStack();
|
|
|
|
|
|
|
|
~QgsPropertyCollectionStack();
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QgsPropertyCollectionStack( const QgsPropertyCollectionStack &other );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
//QgsPropertyCollectionStack &operator=( const QgsPropertyCollectionStack &other );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
int count() const;
|
|
|
|
void clear();
|
2017-05-01 16:42:33 +02:00
|
|
|
void appendCollection( QgsPropertyCollection *collection /Transfer/ );
|
|
|
|
QgsPropertyCollection *at( int index );
|
|
|
|
//const QgsPropertyCollection *at( int index ) const;
|
|
|
|
QgsPropertyCollection *collection( const QString &name );
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
bool hasActiveProperties() const;
|
|
|
|
|
2017-01-20 07:45:11 +10:00
|
|
|
bool hasDynamicProperties() const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
bool isActive( int key ) const;
|
|
|
|
|
2017-01-18 22:47:55 +10:00
|
|
|
QgsProperty property( int key ) const;
|
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QVariant value( int key, const QgsExpressionContext &context, const QVariant &defaultValue = QVariant() ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
bool prepare( const QgsExpressionContext &context = QgsExpressionContext() ) const;
|
2017-01-10 13:33:17 +10:00
|
|
|
|
2017-05-01 16:42:33 +02:00
|
|
|
QSet< QString > referencedFields( const QgsExpressionContext &context = QgsExpressionContext() ) const;
|
2017-01-04 07:16:44 +10:00
|
|
|
|
|
|
|
QSet<int> propertyKeys() const;
|
|
|
|
bool hasProperty( int key ) const;
|
2017-03-09 09:46:06 +01:00
|
|
|
virtual QVariant toVariant( const QgsPropertiesDefinition &definitions ) const;
|
|
|
|
virtual bool loadVariant( const QVariant &collection, const QgsPropertiesDefinition &definitions );
|
2017-01-04 07:16:44 +10:00
|
|
|
};
|
|
|
|
|