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
Showing with 2,603 additions and 4,247 deletions.
  1. +4 −0 doc/api_break.dox
  2. +0 −2 python/core/core.sip
  3. +0 −179 python/core/qgsdatadefined.sip
  4. +8 −0 python/core/qgsproperty.sip
  5. +47 −10 python/core/qgspropertytransformer.sip
  6. +0 −95 python/core/qgsscaleexpression.sip
  7. +1 −2 python/gui/gui.sip
  8. +0 −309 python/gui/qgsdatadefinedbutton.sip
  9. +18 −0 python/gui/qgspropertyassistantwidget.sip
  10. +0 −20 python/gui/symbology-ng/qgssizescalewidget.sip
  11. +0 −1 src/app/composer/qgscomposeritemwidget.h
  12. +0 −1 src/app/composer/qgscompositionwidget.h
  13. +13 −1 src/app/qgsdiagramproperties.cpp
  14. +0 −4 src/core/CMakeLists.txt
  15. +4 −4 src/core/composer/qgscomposerobject.cpp
  16. +0 −286 src/core/qgsdatadefined.cpp
  17. +0 −218 src/core/qgsdatadefined.h
  18. +0 −88 src/core/qgsdatadefined_p.h
  19. +2 −2 src/core/qgsdiagramrenderer.cpp
  20. +1 −1 src/core/qgsexpressioncontextgenerator.h
  21. +5 −5 src/core/qgspallabeling.cpp
  22. +57 −1 src/core/qgsproperty.cpp
  23. +19 −0 src/core/qgsproperty.h
  24. +262 −1 src/core/qgspropertytransformer.cpp
  25. +146 −0 src/core/qgspropertytransformer.h
  26. +0 −171 src/core/qgsscaleexpression.cpp
  27. +0 −129 src/core/qgsscaleexpression.h
  28. +6 −7 src/core/symbology-ng/qgscategorizedsymbolrenderer.cpp
  29. +6 −7 src/core/symbology-ng/qgsgraduatedsymbolrenderer.cpp
  30. +6 −7 src/core/symbology-ng/qgssinglesymbolrenderer.cpp
  31. +1 −1 src/core/symbology-ng/qgssymbol.cpp
  32. +5 −5 src/core/symbology-ng/qgssymbollayer.cpp
  33. +4 −4 src/customwidgets/CMakeLists.txt
  34. +2 −2 src/customwidgets/qgiscustomwidgets.cpp
  35. +22 −22 src/customwidgets/{qgsdatadefinedbuttonplugin.cpp → qgspropertyoverridebuttonplugin.cpp}
  36. +7 −7 src/customwidgets/{qgsdatadefinedbuttonplugin.h → qgspropertyoverridebuttonplugin.h}
  37. +2 −4 src/gui/CMakeLists.txt
  38. +0 −919 src/gui/qgsdatadefinedbutton.cpp
  39. +0 −401 src/gui/qgsdatadefinedbutton.h
  40. +543 −0 src/gui/qgspropertyassistantwidget.cpp
  41. +195 −0 src/gui/qgspropertyassistantwidget.h
  42. +90 −23 src/gui/qgspropertyoverridebutton.cpp
  43. +12 −0 src/gui/qgspropertyoverridebutton.h
  44. +0 −8 src/gui/symbology-ng/qgsrendererwidget.cpp
  45. +8 −4 src/gui/symbology-ng/qgsrendererwidget.h
  46. +0 −310 src/gui/symbology-ng/qgssizescalewidget.cpp
  47. +0 −94 src/gui/symbology-ng/qgssizescalewidget.h
  48. +12 −44 src/gui/symbology-ng/qgssymbollayerwidget.cpp
  49. +5 −12 src/gui/symbology-ng/qgssymbollayerwidget.h
  50. +11 −8 src/gui/symbology-ng/qgssymbolslistwidget.cpp
  51. +5 −0 src/gui/symbology-ng/qgssymbolslistwidget.h
  52. +106 −55 src/ui/qgsdiagrampropertiesbase.ui
  53. +195 −0 src/ui/qgspropertyassistantwidgetbase.ui
  54. +110 −0 src/ui/qgspropertycolorassistantwidget.ui
  55. +127 −0 src/ui/qgspropertygenericnumericassistantwidget.ui
  56. +131 −0 src/ui/qgspropertysizeassistantwidget.ui
  57. +0 −285 src/ui/symbollayer/widget_size_scale.ui
  58. +0 −2 tests/src/core/CMakeLists.txt
  59. +0 −327 tests/src/core/testqgsdatadefined.cpp
  60. +405 −48 tests/src/core/testqgsproperty.cpp
  61. +0 −111 tests/src/core/testqgsscaleexpression.cpp
@@ -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.
You can’t perform that action at this time.