Skip to content
Permalink
Browse files

Update sip bindings

  • Loading branch information
nyalldawson committed Feb 14, 2017
1 parent c78f940 commit 3ca0b90a97e2cf0a5a9ad05b502b4a10454f07e9
@@ -272,6 +272,7 @@ 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.
@@ -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/;
@@ -50,11 +52,42 @@ class QgsPropertyTransformer
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:

@@ -111,7 +144,7 @@ class QgsSizeScaleTransformer : QgsPropertyTransformer
class QgsColorRampTransformer : QgsPropertyTransformer
{
%TypeHeaderCode
#include <qgsproperty.h>
#include <qgspropertytransformer.h>
%End
public:

@@ -6,7 +6,13 @@ class QgsPropertyAssistantWidget : public QgsPanelWidget

public:

QgsPropertyAssistantWidget( QWidget* parent /TransferThis/ = nullptr );
QgsPropertyAssistantWidget( QWidget* parent /TransferThis/ = 0, const QgsPropertyDefinition& definition = QgsPropertyDefinition(),
const QgsProperty& initialState = QgsProperty(),
const QgsVectorLayer* layer = 0 );

};
void registerExpressionContextGenerator( QgsExpressionContextGenerator* generator );

void updateProperty( QgsProperty& property );

void setDockMode( bool dockMode );
};
@@ -61,7 +61,7 @@ QgsPropertyAssistantWidget::QgsPropertyAssistantWidget( QWidget* parent ,
mRoot.addChildNode( mLayerTreeLayer ); // takes ownership
}
mLegendPreview->setModel( &mPreviewList );
mLegendPreview->setItemDelegate( new ItemDelegate( &mPreviewList ) );
mLegendPreview->setItemDelegate( new QgsAssistantPreviewItemDelegate( &mPreviewList ) );
mLegendPreview->setHeaderHidden( true );
mLegendPreview->expandAll();
mLegendVerticalFrame->setLayout( new QVBoxLayout() );
@@ -140,6 +140,7 @@ class GUI_EXPORT QgsPropertyAssistantWidget : public QgsPanelWidget, private Ui:
/**
* Sets a symbol which can be used for previews inside the widget. If not specified, default
* created symbols will be used instead.
* @note not available in Python bindings
*/
void setSymbol( std::shared_ptr< QgsSymbol > symbol ) { mSymbol = symbol; updatePreview(); }

@@ -170,12 +171,12 @@ class GUI_EXPORT QgsPropertyAssistantWidget : public QgsPanelWidget, private Ui:


/// @cond PRIVATE
class ItemDelegate : public QItemDelegate
class QgsAssistantPreviewItemDelegate : public QItemDelegate
{
Q_OBJECT

public:
explicit ItemDelegate( QStandardItemModel* model ) : mModel( model ) {}
explicit QgsAssistantPreviewItemDelegate( QStandardItemModel* model ) : mModel( model ) {}

QSize sizeHint( const QStyleOptionViewItem& /*option*/, const QModelIndex & index ) const override
{
@@ -159,6 +159,7 @@ class GUI_EXPORT QgsPropertyOverrideButton: public QToolButton
/**
* Sets a symbol which can be used for previews inside the widget or in any dialog created
* by the widget. If not specified, a default created symbol will be used instead.
* @note not available in Python bindings
*/
void setSymbol( std::shared_ptr< QgsSymbol > symbol ) { mSymbol = symbol; }

0 comments on commit 3ca0b90

Please sign in to comment.
You can’t perform that action at this time.