19#include <QStandardItem> 
   57  if ( !abstractMetadata )
 
   59    QgsDebugError( 
"Failed to find symbol layer's entry in registry: " + name );
 
   65    QgsDebugError( 
"Failed to cast symbol layer's metadata: " + name );
 
   72static void _initWidgetFunctions()
 
   74  static bool sInitialized = 
false;
 
  121  connect( mEnabledCheckBox, &QCheckBox::toggled, 
this, &QgsLayerPropertiesWidget::mEnabledCheckBox_toggled );
 
  125  _initWidgetFunctions();
 
  139  cboLayerType->setCurrentIndex( idx );
 
  141  connect( mEnabledCheckBox, &QAbstractButton::toggled, mEnabledDDBtn, &QWidget::setEnabled );
 
 
  181  mEffectWidget->setDockMode( this->
dockMode() );
 
 
  188  const auto constSymbolLayerIds = symbolLayerIds;
 
  189  for ( 
const QString &symbolLayerId : constSymbolLayerIds )
 
  195    const auto constLineLayerIds = lineLayerIds;
 
  196    for ( 
const QString &lineLayerId : constLineLayerIds )
 
  201        const QString visibleName = layerInfo->
visibleName();
 
  202        const QString name = tr( 
"Outline: %1" ).arg( visibleName );
 
  203        cboLayerType->addItem( name, lineLayerId );
 
 
  211  if ( stackedWidget->currentWidget() != pageDummy )
 
  214    if ( 
QgsSymbolLayerWidget *w = qobject_cast< QgsSymbolLayerWidget * >( stackedWidget->currentWidget() ) )
 
  216    stackedWidget->removeWidget( stackedWidget->currentWidget() );
 
  221  const QString layerType = layer->
layerType();
 
  230      stackedWidget->addWidget( w );
 
  231      stackedWidget->setCurrentWidget( w );
 
  239  stackedWidget->setCurrentWidget( pageDummy );
 
 
  245    return *lExpressionContext;
 
  252  if ( 
auto *lMapCanvas = mContext.
mapCanvas() )
 
  258      expContext << generator->createExpressionContextScope();
 
  275  expContext << symbolScope;
 
  302                                      << QStringLiteral( 
"symbol_layer_count" ) << QStringLiteral( 
"symbol_layer_index" )
 
  303                                      << QStringLiteral( 
"symbol_frame" ) );
 
 
  315void QgsLayerPropertiesWidget::updateProperty()
 
  328  const QString newLayerType = cboLayerType->currentData().toString();
 
  329  if ( layer->
layerType() == newLayerType )
 
  346    if ( generator->subSymbol() && generator->subSymbol()->symbolLayerCount() > 0 )
 
  347      properties = generator->subSymbol()->symbolLayer( 0 )->properties();
 
  364          std::unique_ptr< QgsMarkerSymbol > markerSymbol = std::make_unique< QgsMarkerSymbol >( 
QgsSymbolLayerList( {layer->
clone() } ) );
 
  366          generator->setSubSymbol( markerSymbol.release() );
 
  371          std::unique_ptr< QgsLineSymbol > lineSymbol = std::make_unique< QgsLineSymbol >( 
QgsSymbolLayerList( {layer->
clone() } ) );
 
  373          generator->setSubSymbol( lineSymbol.release() );
 
  378          std::unique_ptr< QgsFillSymbol > fillSymbol = std::make_unique< QgsFillSymbol >( 
QgsSymbolLayerList( {layer->
clone() } ) );
 
  380          generator->setSubSymbol( fillSymbol.release() );
 
  401    const QString defaultFont = fontMarker->fontFamily();
 
  402    const QFontDatabase fontDb;
 
  403    if ( !fontDb.hasFamily( defaultFont ) )
 
  406      const QStringList candidates = fontDb.families( QFontDatabase::WritingSystem::Symbol );
 
  407      bool foundGoodCandidate = 
false;
 
  408      for ( 
const QString &candidate : candidates )
 
  410        if ( fontDb.writingSystems( candidate ).size() == 1 )
 
  413          fontMarker->setFontFamily( candidate );
 
  414          foundGoodCandidate = 
true;
 
  418      if ( !foundGoodCandidate && !candidates.empty() )
 
  421        QString candidate = candidates.at( 0 );
 
  422        fontMarker->setFontFamily( candidate );
 
  427    const QFontMetrics fontMetrics( fontMarker->fontFamily() );
 
  428    ushort character = fontMarker->character().at( 0 ).unicode();
 
  429    for ( ; character < 1000; ++character )
 
  431      if ( fontMetrics.inFont( QChar( character ) ) )
 
  433        fontMarker->setCharacter( QChar( character ) );
 
 
  448  bool paintEffectToggled = 
false;
 
  452    paintEffectToggled = 
true;
 
  455  if ( paintEffectToggled )
 
 
  462void QgsLayerPropertiesWidget::reloadLayer()
 
  467void QgsLayerPropertiesWidget::mEnabledCheckBox_toggled( 
bool enabled )
 
@ Millimeters
Millimeters.
 
static QgsSymbolLayerRegistry * symbolLayerRegistry()
Returns the application's symbol layer registry, used for managing symbol layers.
 
Abstract interface for generating an expression context scope.
 
Single scope for storing variables and functions for use within a QgsExpressionContext.
 
void addVariable(const QgsExpressionContextScope::StaticVariable &variable)
Adds a variable into the context scope.
 
static QgsExpressionContextScope * updateSymbolScope(const QgsSymbol *symbol, QgsExpressionContextScope *symbolScope=nullptr)
Updates a symbol scope related to a QgsSymbol to an expression context.
 
static QgsExpressionContextScope * projectScope(const QgsProject *project)
Creates a new scope which contains variables and functions relating to a QGIS project.
 
static QgsExpressionContextScope * atlasScope(const 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.
 
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
 
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context.
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
static const QString EXPR_GEOMETRY_PART_COUNT
Inbuilt variable name for geometry part count variable.
 
static const QString EXPR_GEOMETRY_POINT_COUNT
Inbuilt variable name for point count variable.
 
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 setOriginalValueVariable(const QVariant &value)
Sets the original value variable value for the context.
 
static const QString EXPR_GEOMETRY_RING_NUM
Inbuilt variable name for geometry ring number variable.
 
static const QString EXPR_GEOMETRY_PART_NUM
Inbuilt variable name for geometry part number variable.
 
static const QString EXPR_SYMBOL_COLOR
Inbuilt variable name for symbol color variable.
 
QgsExpressionContextScope * lastScope()
Returns the last scope added to the context.
 
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
 
void setHighlightedVariables(const QStringList &variableNames)
Sets the list of variable names within the context intended to be highlighted to the user.
 
static const QString EXPR_ORIGINAL_VALUE
Inbuilt variable name for value original value variable.
 
static const QString EXPR_CLUSTER_COLOR
Inbuilt variable name for cluster color variable.
 
The QgsMapSettings class contains configuration for rendering of the map.
 
Struct for storing maximum and minimum scales for measurements in map units.
 
static QgsPaintEffect * defaultStack()
Returns a new effect stack consisting of a sensible selection of default effects.
 
void setEnabled(bool enabled)
Sets whether the effect is enabled.
 
bool enabled() const
Returns whether the effect is enabled.
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
Registry of available symbol layer classes.
 
QStringList symbolLayersForType(Qgis::SymbolType type)
Returns a list of available symbol layers for a specified symbol type.
 
QgsSymbolLayerAbstractMetadata * symbolLayerMetadata(const QString &name) const
Returns metadata for specified symbol layer. Returns nullptr if not found.
 
static QPicture symbolLayerPreviewPicture(const QgsSymbolLayer *layer, Qgis::RenderUnit units, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::SymbolType parentSymbolType=Qgis::SymbolType::Hybrid)
Draws a symbol layer preview to a QPicture.
 
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
 
virtual bool setSubSymbol(QgsSymbol *symbol)
Sets layer's subsymbol. takes ownership of the passed symbol.
 
Property
Data definable properties.
 
@ LayerEnabled
Whether symbol layer is enabled.
 
void setPaintEffect(QgsPaintEffect *effect)
Sets the current paint effect for the layer.
 
QgsPaintEffect * paintEffect() const
Returns the current paint effect for the layer.
 
void setEnabled(bool enabled)
Sets whether symbol layer is enabled and should be drawn.
 
virtual QVariantMap properties() const =0
Should be reimplemented by subclasses to return a string map that contains the configuration informat...
 
bool enabled() const
Returns true if symbol layer is enabled and will be drawn.
 
virtual QString layerType() const =0
Returns a string that represents this layer type.
 
virtual void setDataDefinedProperty(Property key, const QgsProperty &property)
Sets a data defined property for the layer.
 
virtual QgsSymbol * subSymbol()
Returns the symbol's sub symbol, if present.
 
virtual QColor color() const
Returns the "representative" color of the symbol layer.
 
static const QgsPropertiesDefinition & propertyDefinitions()
Returns the symbol layer property definitions.
 
QgsPropertyCollection & dataDefinedProperties()
Returns a reference to the symbol layer's property collection, used for data defined overrides.
 
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
 
QList< QgsExpressionContextScope > additionalExpressionContextScopes() const
Returns the list of additional expression context scopes to show as available within the layer.
 
void setSymbolType(Qgis::SymbolType type)
Sets the associated symbol type, if the widget is being shown as a subcomponent of a parent symbol co...
 
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
 
QgsMapCanvas * mapCanvas() const
Returns the map canvas associated with the widget.
 
Abstract base class for all rendered symbols.
 
virtual QgsSymbol * clone() const =0
Returns a deep copy of this symbol.
 
Qgis::SymbolType type() const
Returns the symbol's type.
 
Represents a vector layer which manages a vector based data sets.
 
#define QgsDebugError(str)
 
QList< QgsSymbolLayer * > QgsSymbolLayerList
 
QgsSymbolLayerWidget *(* QgsSymbolLayerWidgetFunc)(QgsVectorLayer *)
 
Single variable definition for use within a QgsExpressionContextScope.