19 #include <QStandardItem> 21 #include <QMessageBox> 45 if ( !abstractMetadata )
47 QgsDebugMsg(
"Failed to find symbol layer's entry in registry: " + name );
53 QgsDebugMsg(
"Failed to cast symbol layer's metadata: " + name );
60 static void _initWidgetFunctions()
62 static bool sInitialized =
false;
100 connect( mEnabledCheckBox, &QCheckBox::toggled,
this, &QgsLayerPropertiesWidget::mEnabledCheckBox_toggled );
104 _initWidgetFunctions();
118 cboLayerType->setCurrentIndex( idx );
120 connect( mEnabledCheckBox, &QAbstractButton::toggled, mEnabledDDBtn, &QWidget::setEnabled );
153 mEffectWidget->setDockMode( this->
dockMode() );
160 Q_FOREACH (
const QString &symbolLayerId, symbolLayerIds )
166 Q_FOREACH (
const QString &lineLayerId, lineLayerIds )
172 QString name = QString( tr(
"Outline: %1" ) ).arg( visibleName );
173 cboLayerType->addItem( name, lineLayerId );
181 if ( stackedWidget->currentWidget() != pageDummy )
184 if (
QgsSymbolLayerWidget *w = qobject_cast< QgsSymbolLayerWidget * >( stackedWidget->currentWidget() ) )
186 stackedWidget->removeWidget( stackedWidget->currentWidget() );
200 stackedWidget->addWidget( w );
201 stackedWidget->setCurrentWidget( w );
209 stackedWidget->setCurrentWidget( pageDummy );
241 expContext << symbolScope;
271 void QgsLayerPropertiesWidget::updateProperty()
284 QString newLayerType = cboLayerType->currentData().toString();
285 if ( layer->
layerType() == newLayerType )
313 void QgsLayerPropertiesWidget::reloadLayer()
318 void QgsLayerPropertiesWidget::mEnabledCheckBox_toggled(
bool enabled )
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
static QgsSymbolLayerRegistry * symbolLayerRegistry()
Returns the application's symbol layer registry, used for managing symbol layers. ...
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
Single variable definition for use within a QgsExpressionContextScope.
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the layer.
QStringList symbolLayersForType(QgsSymbol::SymbolType type)
return a list of available symbol layers for a specified symbol type
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
virtual QgsStringMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
The QgsMapSettings class contains configuration for rendering of the map.
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
QgsSymbolLayerAbstractMetadata * symbolLayerMetadata(const QString &name) const
return metadata for specified symbol layer. Returns NULL if not found
Registry of available symbol layer classes.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown...
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides...
virtual QColor color() const
The fill color.
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
Single scope for storing variables and functions for use within a QgsExpressionContext.
void setEnabled(bool enabled)
Sets whether symbol layer is enabled and should be drawn.
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
QgsSymbolLayerWidget *(* QgsSymbolLayerWidgetFunc)(QgsVectorLayer *)
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
static QgsExpressionContextScope * atlasScope(QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object...
QgsExpressionContextScope & expressionContextScope()
Returns a reference to the expression context scope for the map canvas.
static QPicture symbolLayerPreviewPicture(QgsSymbolLayer *layer, QgsUnitTypes::RenderUnit units, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
Draws a symbol layer preview to a QPicture.
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
static QgsProject * instance()
Returns the QgsProject singleton instance.
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
static const QString EXPR_GEOMETRY_POINT_NUM
Inbuilt variable name for point number variable.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user...
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
Represents a vector layer which manages a vector based data sets.
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
Whether symbol layer is enabled.
Property
Data definable properties.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer...
virtual QString layerType() const =0
Returns a string that represents this layer type.