Skip to content
Permalink
Browse files
Merge pull request #4141 from nyalldawson/props_gui
Properties framework part 2 - gui component
  • Loading branch information
nyalldawson committed Feb 14, 2017
2 parents edb30a2 + efb0c40 commit e4d45e4935a82b49aece20ff739c7b5aef80d45a
Show file tree
Hide file tree
Showing 61 changed files with 2,603 additions and 4,247 deletions.
@@ -250,6 +250,8 @@ Use QgsComposerAttributeTableV2 instead.
- QgsCRSCache was removed. QgsCoordinateReferenceSystem now internally uses a cache for CRS creation,
so there is no longer a need for the separate cache class. Code which previously called QgsCRSCache::updateCRSCache()
should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinateTransformCache::instance()->invalidateCrs( authid ).
- QgsDataDefined was removed. Use the QgsProperty framework instead.
- QgsDataDefinedButton was removed. Use QgsPropertyOverrideButton instead.
- QgsFileNameWidgetWrapper was removed. Use QgsExternalResourceWidgetWrapper instead.
- QgsFormAnnotationItem. Use QgsFormAnnotation instead.
- QgsHtmlAnnotationItem. Use QgsHtmlAnnotation instead.
@@ -270,10 +272,12 @@ should now call QgsCoordinateReferenceSystem::invalidateCache() and QgsCoordinat
- QgsPseudoColorShader. This shader has been broken for some time and was replaced by QgsSingleBandPseudoColorRenderer.
- QgsProjectBadLayerGuiHandler was removed. It was unused in QGIS code and barely useful. Implement your own QgsProjectBadLayerHandler subclass if needed.
- QgsRendererV2DataDefinedMenus was removed. Use QgsDataDefinedButton instead.
- QgsSizeScaleWidget. Use QgsPropertyAssistantWidget instead.
- QgsLegacyHelpers.
- QgsProviderCountCalcEvent and QgsProviderExtentCalcEvent. These classes were unused in QGIS core and unmaintained.
- QgsWebviewWidgetWrapper was removed. Use QgsExternalResourceWidgetWrapper instead.
- QgsEditorWidgetConfig was removed. Use QVariantMap instead.
- QgsScaleExpression. Use QgsProperty with a QgsSizeScalePropertyTransformer instead.
- QgsSvgAnnotationItem. Use QgsSvgAnnotation instead.
- QgsSymbologyV2Conversion was removed. Reading of renderers from pre-1.0 versions is not supported anymore.
- QgsTextAnnotationItem. Use QgsTextAnnotation instead.
@@ -33,7 +33,6 @@
%Include qgscoordinatetransform.sip
%Include qgscredentials.sip
%Include qgscrscache.sip
%Include qgsdatadefined.sip
%Include qgsdataitem.sip
%Include qgsdataitemprovider.sip
%Include qgsdataitemproviderregistry.sip
@@ -131,7 +130,6 @@
%Include qgsrunprocess.sip
%Include qgsruntimeprofiler.sip
%Include qgsscalecalculator.sip
%Include qgsscaleexpression.sip
%Include qgsscaleutils.sip
%Include qgssimplifymethod.sip
%Include qgssnapper.sip

This file was deleted.

@@ -14,6 +14,7 @@ class QgsPropertyDefinition
Double,
DoublePositive,
Double0To1,
Rotation,
String,
Transparency,
RenderUnits,
@@ -25,6 +26,7 @@ class QgsPropertyDefinition
Size,
Size2D,
LineStyle,
StrokeWidth,
FillStyle,
CapStyle,
HorizontalAnchor,
@@ -57,6 +59,7 @@ class QgsPropertyDefinition

StandardPropertyTemplate standardTemplate() const;

bool supportsAssistant() const;
};

class QgsProperty
@@ -87,6 +90,9 @@ class QgsProperty

operator bool() const;

bool operator==( const QgsProperty& other ) const;
bool operator!=( const QgsProperty& other ) const;

Type propertyType() const;

bool isActive() const;
@@ -131,6 +137,8 @@ class QgsProperty

const QgsPropertyTransformer* transformer() const;

bool convertToTransformer();

};


@@ -1,25 +1,27 @@
class QgsPropertyTransformer
{
%TypeHeaderCode
#include <qgsproperty.h>
#include <qgspropertytransformer.h>
%End

%ConvertToSubClassCode
if (sipCpp->transformerType() == QgsPropertyTransformer::SizeScaleTransformer)
sipType = sipType_QgsSizeScaleTransformer;
if (sipCpp->transformerType() == QgsPropertyTransformer::GenericNumericTransformer)
sipType = sipType_QgsGenericNumericTransformer;
else if (sipCpp->transformerType() == QgsPropertyTransformer::SizeScaleTransformer)
sipType = sipType_QgsSizeScaleTransformer;
else if (sipCpp->transformerType() == QgsPropertyTransformer::ColorRampTransformer)
sipType = sipType_QgsColorRampTransformer;
sipType = sipType_QgsColorRampTransformer;
else
sipType = sipType_QgsPropertyTransformer;
sipType = sipType_QgsPropertyTransformer;
%End

public:

//! Transformer types
enum Type
{
SizeScaleTransformer, /*!< Size scaling transformer (QgsSizeScaleTransformer) */
ColorRampTransformer, /*!< Color ramp transformer (QgsColorRampTransformer) */
GenericNumericTransformer,
SizeScaleTransformer,
ColorRampTransformer,
};

static QgsPropertyTransformer* create( Type type ) /Factory/;
@@ -47,12 +49,45 @@ class QgsPropertyTransformer
virtual QVariant transform( const QgsExpressionContext& context, const QVariant& value ) const = 0;
virtual QString toExpression( const QString& baseExpression ) const = 0;

static QgsPropertyTransformer* fromExpression( const QString& expression, QString& baseExpression /Out/, QString& fieldName /Out/ ) /Factory/;

};
class QgsGenericNumericTransformer : QgsPropertyTransformer
{
%TypeHeaderCode
#include <qgspropertytransformer.h>
%End

public:
QgsGenericNumericTransformer( double minValue = 0.0,
double maxValue = 1.0,
double minOutput = 0.0,
double maxOutput = 1.0,
double nullOutput = 0.0,
double exponent = 1.0 );

virtual Type transformerType() const;
virtual QgsGenericNumericTransformer* clone() /Factory/;
virtual bool writeXml( QDomElement& transformerElem, QDomDocument& doc ) const;
virtual bool readXml( const QDomElement& transformerElem, const QDomDocument& doc );
virtual QVariant transform( const QgsExpressionContext& context, const QVariant& value ) const;
virtual QString toExpression( const QString& baseExpression ) const;
static QgsGenericNumericTransformer* fromExpression( const QString& expression, QString& baseExpression, QString& fieldName ) /Factory/;
double value( double input ) const;
double minOutputValue() const;
void setMinOutputValue( double size );
double maxOutputValue() const;
void setMaxOutputValue( double size );
double nullOutputValue() const;
void setNullOutputValue( double size );
double exponent() const;
void setExponent( double exponent );

};
class QgsSizeScaleTransformer : QgsPropertyTransformer
{
%TypeHeaderCode
#include <qgsproperty.h>
#include <qgspropertytransformer.h>
%End
public:

@@ -80,6 +115,8 @@ class QgsSizeScaleTransformer : QgsPropertyTransformer
virtual QVariant transform( const QgsExpressionContext& context, const QVariant& value ) const;
virtual QString toExpression( const QString& baseExpression ) const;

static QgsSizeScaleTransformer* fromExpression( const QString& expression, QString& baseExpression /Out/, QString& fieldName /Out/ ) /Factory/;

double size( double value ) const;

double minSize() const;
@@ -107,7 +144,7 @@ class QgsSizeScaleTransformer : QgsPropertyTransformer
class QgsColorRampTransformer : QgsPropertyTransformer
{
%TypeHeaderCode
#include <qgsproperty.h>
#include <qgspropertytransformer.h>
%End
public:

0 comments on commit e4d45e4

Please sign in to comment.