QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
19 #include <QStandardItem>
21 #include <QMessageBox>
51 if ( !abstractMetadata )
53 QgsDebugMsg(
"Failed to find symbol layer's entry in registry: " + name );
59 QgsDebugMsg(
"Failed to cast symbol layer's metadata: " + name );
66 static void _initWidgetFunctions()
68 static bool sInitialized =
false;
110 connect( mEnabledCheckBox, &QCheckBox::toggled,
this, &QgsLayerPropertiesWidget::mEnabledCheckBox_toggled );
114 _initWidgetFunctions();
128 cboLayerType->setCurrentIndex( idx );
130 connect( mEnabledCheckBox, &QAbstractButton::toggled, mEnabledDDBtn, &QWidget::setEnabled );
168 mEffectWidget->setDockMode( this->
dockMode() );
175 const auto constSymbolLayerIds = symbolLayerIds;
176 for (
const QString &symbolLayerId : constSymbolLayerIds )
182 const auto constLineLayerIds = lineLayerIds;
183 for (
const QString &lineLayerId : constLineLayerIds )
189 QString name = tr(
"Outline: %1" ).arg( visibleName );
190 cboLayerType->addItem( name, lineLayerId );
198 if ( stackedWidget->currentWidget() != pageDummy )
201 if (
QgsSymbolLayerWidget *w = qobject_cast< QgsSymbolLayerWidget * >( stackedWidget->currentWidget() ) )
203 stackedWidget->removeWidget( stackedWidget->currentWidget() );
217 stackedWidget->addWidget( w );
218 stackedWidget->setCurrentWidget( w );
226 stackedWidget->setCurrentWidget( pageDummy );
232 return *lExpressionContext;
239 if (
auto *lMapCanvas = mContext.
mapCanvas() )
245 expContext << generator->createExpressionContextScope();
262 expContext << symbolScope;
286 << QStringLiteral(
"symbol_layer_count" ) << QStringLiteral(
"symbol_layer_index" ) );
298 void QgsLayerPropertiesWidget::updateProperty()
311 QString newLayerType = cboLayerType->currentData().toString();
312 if ( layer->
layerType() == newLayerType )
336 bool paintEffectToggled =
false;
340 paintEffectToggled =
true;
343 if ( paintEffectToggled )
350 void QgsLayerPropertiesWidget::reloadLayer()
355 void QgsLayerPropertiesWidget::mEnabledCheckBox_toggled(
bool enabled )
void setEnabled(bool enabled)
Sets whether symbol layer is enabled and should be drawn.
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
virtual QColor color() const
The fill color.
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
static const QString EXPR_GEOMETRY_POINT_NUM
Inbuilt variable name for point number variable.
void setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
static QgsExpressionContextScope * mapSettingsScope(const QgsMapSettings &mapSettings)
Creates a new scope which contains variables and functions relating to a QgsMapSettings object.
static QgsProject * instance()
Returns the QgsProject singleton instance.
@ RenderMillimeters
Millimeters.
Registry of available symbol layer classes.
Abstract interface for generating an expression context scope.
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
Abstract base class for all rendered symbols.
static QgsPaintEffect * defaultStack()
Returns a new effect stack consisting of a sensible selection of default effects.
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
virtual QgsStringMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
static QgsSymbolLayerRegistry * symbolLayerRegistry()
Returns the application's symbol layer registry, used for managing symbol layers.
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
QgsSymbolLayerWidget *(* QgsSymbolLayerWidgetFunc)(QgsVectorLayer *)
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the layer.
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the layer.
void setEnabled(bool enabled)
Sets whether the effect is enabled.
QStringList symbolLayersForType(QgsSymbol::SymbolType type)
Returns a list of available symbol layers for a specified symbol type.
Single scope for storing variables and functions for use within a QgsExpressionContext.
@ PropertyLayerEnabled
Whether symbol layer is enabled.
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
static const QString EXPR_CLUSTER_SIZE
Inbuilt variable name for cluster size variable.
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
Represents a vector layer which manages a vector based data sets.
static QPicture symbolLayerPreviewPicture(const QgsSymbolLayer *layer, QgsUnitTypes::RenderUnit units, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale())
Draws a symbol layer preview to a QPicture.
SymbolType type() const
Returns the symbol's type.
static QgsExpressionContextScope * atlasScope(const QgsLayoutAtlas *atlas)
Creates a new scope which contains variables and functions relating to a QgsLayoutAtlas.
Property
Data definable properties.
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
virtual QString layerType() const =0
Returns a string that represents this layer type.
bool enabled() const
Returns whether the effect is enabled.
Single variable definition for use within a QgsExpressionContextScope.
The QgsMapSettings class contains configuration for rendering of the map.
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
QgsSymbolLayerAbstractMetadata * symbolLayerMetadata(const QString &name) const
Returns metadata for specified symbol layer. Returns nullptr if not found.