39#include <QColorDialog> 
   41#include <QStandardItemModel> 
   42#include <QInputDialog> 
   49#include <QStandardItem> 
   53static const int SYMBOL_LAYER_ITEM_TYPE = QStandardItem::UserType + 1;
 
   63    mDDSize = mMarker->dataDefinedSize();
 
   64    mDDAngle = mMarker->dataDefinedAngle();
 
   66    if ( !mDDSize && !mDDAngle )
 
   73    mDDWidth = mLine->dataDefinedWidth();
 
   81void DataDefinedRestorer::save()
 
   85    mSize = mMarkerSymbolLayer->size();
 
   86    mAngle = mMarkerSymbolLayer->angle();
 
   87    mMarkerOffset = mMarkerSymbolLayer->offset();
 
   91    mWidth = mLineSymbolLayer->width();
 
   92    mLineOffset = mLineSymbolLayer->offset();
 
   96void DataDefinedRestorer::restore()
 
  101         ( mSize != mMarkerSymbolLayer->size() || mMarkerOffset != mMarkerSymbolLayer->offset() ) )
 
  102      mMarker->setDataDefinedSize( mDDSize );
 
  104         mAngle != mMarkerSymbolLayer->angle() )
 
  105      mMarker->setDataDefinedAngle( mDDAngle );
 
  110         ( mWidth != mLineSymbolLayer->width() || mLineOffset != mLineSymbolLayer->offset() ) )
 
  111      mLine->setDataDefinedWidth( mDDWidth );
 
  118class SymbolLayerItem : 
public QStandardItem
 
  122      : mVectorLayer( vectorLayer )
 
  125      setLayer( layer, symbolType );
 
  129      : mVectorLayer( vectorLayer )
 
  140      mSymbolType = symbolType;
 
  154      if ( !mSize.isValid() )
 
  157        mSize = QSize( size, size );
 
  170      if ( 
auto *lParent = parent() )
 
  171        static_cast<SymbolLayerItem *
>( lParent )->updatePreview();
 
  174    int type()
 const override { 
return SYMBOL_LAYER_ITEM_TYPE; }
 
  175    bool isLayer() { 
return mIsLayer; }
 
  188    QVariant data( 
int role )
 const override 
  190      if ( role == Qt::DisplayRole || role == Qt::EditRole )
 
  202          switch ( mSymbol->type() )
 
  205              return QCoreApplication::translate( 
"SymbolLayerItem", 
"Marker" );
 
  207              return QCoreApplication::translate( 
"SymbolLayerItem", 
"Fill" );
 
  209              return QCoreApplication::translate( 
"SymbolLayerItem", 
"Line" );
 
  215      else if ( role == Qt::ForegroundRole && mIsLayer )
 
  217        if ( !mLayer->enabled() )
 
  219          QPalette 
pal = qApp->palette();
 
  220          QBrush brush = QStandardItem::data( role ).value< QBrush >();
 
  221          brush.setColor( 
pal.color( QPalette::Disabled, QPalette::WindowText ) );
 
  232      if ( role == Qt::CheckStateRole )
 
  234      return QStandardItem::data( role );
 
  240    QPointer< QgsVectorLayer > mVectorLayer;
 
  241    bool mIsLayer = 
false;
 
  244    QPointer< QScreen > mScreen;
 
  258  setWindowModality( Qt::WindowModal );
 
  262  this->layout()->setContentsMargins( 0, 0, 0, 0 );
 
  264  layersTree->setMaximumHeight( 
static_cast< int >( 
Qgis::UI_SCALE_FACTOR * fontMetrics().height() * 7 ) );
 
  265  layersTree->setMinimumHeight( layersTree->maximumHeight() );
 
  266  lblPreview->setMaximumWidth( layersTree->maximumHeight() );
 
  274  iconLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"unlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
 
  275  iconLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"unlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
 
  278  iconColorLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"mIconColorLocked.svg" ) ), QSize(), QIcon::Normal, QIcon::On );
 
  279  iconColorLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"mIconColorLocked.svg" ) ), QSize(), QIcon::Active, QIcon::On );
 
  280  iconColorLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"mIconColorUnlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
 
  281  iconColorLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"mIconColorUnlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
 
  283  mLockColorAction = 
new QAction( tr( 
"Lock Color" ), 
this );
 
  284  mLockColorAction->setToolTip( tr( 
"Avoid changing the color of the layer when the symbol color is changed" ) );
 
  285  mLockColorAction->setCheckable( 
true );
 
  286  mLockColorAction->setIcon( iconColorLock );
 
  288  QIcon iconSelectLock;
 
  289  iconSelectLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"mIconSelectLocked.svg" ) ), QSize(), QIcon::Normal, QIcon::On );
 
  290  iconSelectLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"mIconSelectLocked.svg" ) ), QSize(), QIcon::Active, QIcon::On );
 
  291  iconSelectLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"mIconSelectUnlocked.svg" ) ), QSize(), QIcon::Normal, QIcon::Off );
 
  292  iconSelectLock.addFile( 
QgsApplication::iconPath( QStringLiteral( 
"mIconSelectUnlocked.svg" ) ), QSize(), QIcon::Active, QIcon::Off );
 
  294  mLockSelectionColorAction = 
new QAction( tr( 
"Lock Color When Selected" ), 
this );
 
  295  mLockSelectionColorAction->setToolTip( tr( 
"Avoid changing the color of the layer when a feature is selected" ) );
 
  296  mLockSelectionColorAction->setCheckable( 
true );
 
  297  mLockSelectionColorAction->setIcon( iconSelectLock );
 
  299  QMenu *lockMenu = 
new QMenu( 
this );
 
  300  lockMenu->addAction( mLockColorAction );
 
  301  lockMenu->addAction( mLockSelectionColorAction );
 
  302  btnLock->setMenu( lockMenu );
 
  303  btnLock->setPopupMode( QToolButton::InstantPopup );
 
  309  mSymbolLayersModel = 
new QStandardItemModel( layersTree );
 
  311  layersTree->setModel( mSymbolLayersModel );
 
  312  layersTree->setHeaderHidden( 
true );
 
  324    mPreviewExpressionContext.
setFeature( mPreviewFeature );
 
  332  QItemSelectionModel *selModel = layersTree->selectionModel();
 
  335  loadSymbol( mSymbol, 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() ) );
 
  343  connect( mLockSelectionColorAction, &QAction::toggled, 
this, [ = ]( 
bool checked )
 
  352    updateLockButtonIcon();
 
  358  updateLockButtonIcon();
 
  363  const QModelIndex newIndex = layersTree->model()->index( 0, 0 );
 
  364  layersTree->setCurrentIndex( newIndex );
 
 
  393  widget->mOwnedSymbol = std::move( 
symbol );
 
 
  399  if ( !mAdvancedMenu )
 
  401    mAdvancedMenu = 
new QMenu( 
this );
 
  405  return mAdvancedMenu;
 
 
  414    mPreviewExpressionContext = *lExpressionContext;
 
  418    mPreviewExpressionContext.
setFeature( mPreviewFeature );
 
  421  QWidget *widget = stackedWidget->currentWidget();
 
  423    layerProp->setContext( 
context );
 
  425    listWidget->setContext( 
context );
 
 
  444    mSymbolLayersModel->clear();
 
  445    parent = 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() );
 
  448  SymbolLayerItem *symbolItem = 
new SymbolLayerItem( 
symbol, mVectorLayer, screen() );
 
  449  QFont boldFont = symbolItem->font();
 
  450  boldFont.setBold( 
true );
 
  451  symbolItem->setFont( boldFont );
 
  452  parent->appendRow( symbolItem );
 
  455  for ( 
int i = count - 1; i >= 0; i-- )
 
  458    layerItem->setEditable( 
false );
 
  459    symbolItem->appendRow( layerItem );
 
  464    layersTree->setExpanded( layerItem->index(), 
true );
 
  466  layersTree->setExpanded( symbolItem->index(), 
true );
 
  468  if ( mSymbol == 
symbol && !layersTree->currentIndex().isValid() )
 
  471    layersTree->setCurrentIndex( symbolItem->index() );
 
 
  475void QgsSymbolSelectorWidget::reloadSymbol()
 
  477  mSymbolLayersModel->clear();
 
  478  loadSymbol( mSymbol, 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->invisibleRootItem() ) );
 
  481void QgsSymbolSelectorWidget::updateUi()
 
  483  const QModelIndex currentIdx = layersTree->currentIndex();
 
  484  if ( !currentIdx.isValid() )
 
  487  SymbolLayerItem *item = 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( currentIdx ) );
 
  488  if ( !item->isLayer() )
 
  490    btnUp->setEnabled( 
false );
 
  491    btnDown->setEnabled( 
false );
 
  492    btnRemoveLayer->setEnabled( 
false );
 
  493    btnLock->setEnabled( 
false );
 
  494    btnDuplicate->setEnabled( 
false );
 
  498  const int rowCount = item->parent()->rowCount();
 
  499  const int currentRow = item->row();
 
  501  btnUp->setEnabled( currentRow > 0 );
 
  502  btnDown->setEnabled( currentRow < rowCount - 1 );
 
  503  btnRemoveLayer->setEnabled( rowCount > 1 );
 
  504  btnLock->setEnabled( 
true );
 
  505  btnDuplicate->setEnabled( 
true );
 
  513  std::unique_ptr< QgsSymbol > symbolClone( mSymbol->
clone() );
 
  515  lblPreview->setPixmap( QPixmap::fromImage( preview ) );
 
  517  if ( !mBlockModified )
 
 
  524  SymbolLayerItem *item = currentLayerItem();
 
  526    item->updatePreview();
 
 
  531SymbolLayerItem *QgsSymbolSelectorWidget::currentLayerItem()
 
  533  const QModelIndex idx = layersTree->currentIndex();
 
  534  if ( !idx.isValid() )
 
  537  SymbolLayerItem *item = 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
 
  538  if ( !item->isLayer() )
 
  546  const QModelIndex idx = layersTree->currentIndex();
 
  547  if ( !idx.isValid() )
 
  550  SymbolLayerItem *item = 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
 
  551  if ( item->isLayer() )
 
  552    return item->layer();
 
  561  SymbolLayerItem *currentItem = 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( layersTree->currentIndex() ) );
 
  565  if ( currentItem->isLayer() )
 
  567    SymbolLayerItem *parent = 
static_cast<SymbolLayerItem *
>( currentItem->parent() );
 
  568    mDataDefineRestorer.reset( 
new DataDefinedRestorer( parent->symbol(), currentItem->layer() ) );
 
  572    setWidget( layerProp );
 
  583    mDataDefineRestorer.reset();
 
  585    currentItem->symbol()->setLayer( mVectorLayer );
 
  589    symbolsList->setContext( mContext );
 
  591    setWidget( symbolsList );
 
 
  599  SymbolLayerItem *currentItem = 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( layersTree->currentIndex() ) );
 
  600  if ( !currentItem || currentItem->isLayer() )
 
  604  if ( currentItem->parent() )
 
  608    SymbolLayerItem *parent = 
static_cast<SymbolLayerItem *
>( currentItem->parent() );
 
  609    parent->removeRow( 0 );
 
  611    layersTree->setCurrentIndex( parent->child( 0 )->index() );
 
  612    parent->updatePreview();
 
  618    const QModelIndex newIndex = layersTree->model()->index( 0, 0 );
 
  619    layersTree->setCurrentIndex( newIndex );
 
 
  626void QgsSymbolSelectorWidget::setWidget( QWidget *widget )
 
  628  const int index = stackedWidget->addWidget( widget );
 
  629  stackedWidget->setCurrentIndex( index );
 
  630  if ( mPresentWidget )
 
  631    mPresentWidget->deleteLater();
 
  632  mPresentWidget = widget;
 
  635void QgsSymbolSelectorWidget::updateLockButton()
 
  640  mLockColorAction->setChecked( layer->
isLocked() );
 
  643  updateLockButtonIcon();
 
  646void QgsSymbolSelectorWidget::updateLockButtonIcon()
 
  648  if ( mLockColorAction->isChecked() && mLockSelectionColorAction->isChecked() )
 
  650  else if ( mLockColorAction->isChecked() )
 
  652  else if ( mLockSelectionColorAction->isChecked() )
 
  660  const QModelIndex idx = layersTree->currentIndex();
 
  661  if ( !idx.isValid() )
 
  665  SymbolLayerItem *item = 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
 
  666  if ( item->isLayer() )
 
  668    insertIdx = item->row();
 
  669    item = 
static_cast<SymbolLayerItem *
>( item->parent() );
 
  672  QgsSymbol *parentSymbol = item->symbol();
 
  686  if ( insertIdx == -1 )
 
  693    static_cast<QgsMarkerSymbol *
>( parentSymbol )->setDataDefinedSize( ddSize );
 
  695    static_cast<QgsMarkerSymbol *
>( parentSymbol )->setDataDefinedAngle( ddAngle );
 
  697    static_cast<QgsLineSymbol *
>( parentSymbol )->setDataDefinedWidth( ddWidth );
 
  699  SymbolLayerItem *newLayerItem = 
new SymbolLayerItem( newLayer, parentSymbol->
type(), mVectorLayer, screen() );
 
  700  item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem );
 
  701  item->updatePreview();
 
  703  layersTree->setCurrentIndex( mSymbolLayersModel->indexFromItem( newLayerItem ) );
 
 
  710  SymbolLayerItem *item = currentLayerItem();
 
  711  const int row = item->row();
 
  712  SymbolLayerItem *parent = 
static_cast<SymbolLayerItem *
>( item->parent() );
 
  714  const int layerIdx = parent->rowCount() - row - 1; 
 
  715  QgsSymbol *parentSymbol = parent->symbol();
 
  718  parent->removeRow( row );
 
  719  parent->updatePreview();
 
  721  const QModelIndex newIdx = parent->child( 0 )->index();
 
  722  layersTree->setCurrentIndex( newIdx );
 
 
  732  moveLayerByOffset( + 1 );
 
 
  737  moveLayerByOffset( -1 );
 
 
  740void QgsSymbolSelectorWidget::moveLayerByOffset( 
int offset )
 
  742  SymbolLayerItem *item = currentLayerItem();
 
  745  const int row = item->row();
 
  747  SymbolLayerItem *parent = 
static_cast<SymbolLayerItem *
>( item->parent() );
 
  748  QgsSymbol *parentSymbol = parent->symbol();
 
  750  const int layerIdx = parent->rowCount() - row - 1;
 
  755  QList<QStandardItem *> rowItems = parent->takeRow( row );
 
  756  parent->insertRows( row + offset, rowItems );
 
  757  parent->updatePreview();
 
  759  const QModelIndex newIdx = rowItems[ 0 ]->index();
 
  760  layersTree->setCurrentIndex( newIdx );
 
  771  layer->
setLocked( mLockColorAction->isChecked() );
 
  772  updateLockButtonIcon();
 
 
  778  const QModelIndex idx = layersTree->currentIndex();
 
  779  if ( !idx.isValid() )
 
  782  SymbolLayerItem *item = 
static_cast<SymbolLayerItem *
>( mSymbolLayersModel->itemFromIndex( idx ) );
 
  783  if ( !item->isLayer() )
 
  788  const int insertIdx = item->row();
 
  789  item = 
static_cast<SymbolLayerItem *
>( item->parent() );
 
  791  QgsSymbol *parentSymbol = item->symbol();
 
  795  if ( insertIdx == -1 )
 
  800  SymbolLayerItem *newLayerItem = 
new SymbolLayerItem( newLayer, parentSymbol->
type(), mVectorLayer, screen() );
 
  801  item->insertRow( insertIdx == -1 ? 0 : insertIdx, newLayerItem );
 
  805    layersTree->setExpanded( newLayerItem->index(), 
true );
 
  807  item->updatePreview();
 
  809  layersTree->setCurrentIndex( mSymbolLayersModel->indexFromItem( newLayerItem ) );
 
 
  816  SymbolLayerItem *item = currentLayerItem();
 
  821    item->removeRow( 0 );
 
  831    layersTree->setExpanded( item->index(), 
true );
 
  835  const int layerIdx = item->parent()->rowCount() - item->row() - 1;
 
  838  item->updatePreview();
 
 
  847  setLayout( 
new QVBoxLayout() );
 
  850  mButtonBox = 
new QDialogButtonBox( QDialogButtonBox::Cancel | QDialogButtonBox::Help | QDialogButtonBox::Ok );
 
  852  connect( mButtonBox, &QDialogButtonBox::accepted, 
this, &QDialog::accept );
 
  853  connect( mButtonBox, &QDialogButtonBox::rejected, 
this, &QDialog::reject );
 
  854  connect( mButtonBox, &QDialogButtonBox::helpRequested, 
this, &QgsSymbolSelectorDialog::showHelp );
 
  856  layout()->addWidget( mSelectorWidget );
 
  857  layout()->addWidget( mButtonBox );
 
  861  mSelectorWidget->setMinimumSize( 460, 560 );
 
  862  setObjectName( QStringLiteral( 
"SymbolSelectorDialog" ) );
 
  869    layout()->setContentsMargins( 0, 0, 0, 0 );
 
  873    setWindowTitle( tr( 
"Symbol Selector" ) );
 
 
  895  return mSelectorWidget->
symbol();
 
 
  901  if ( !isWindow() && e->key() == Qt::Key_Escape )
 
  907    QDialog::keyPressEvent( e );
 
 
  911void QgsSymbolSelectorDialog::reloadSymbol()
 
  913  mSelectorWidget->reloadSymbol();
 
  921void QgsSymbolSelectorDialog::updateUi()
 
  923  mSelectorWidget->updateUi();
 
  926void QgsSymbolSelectorDialog::updateLockButton()
 
  928  mSelectorWidget->updateLockButton();
 
  931SymbolLayerItem *QgsSymbolSelectorDialog::currentLayerItem()
 
  933  return mSelectorWidget->currentLayerItem();
 
  938  return mSelectorWidget->currentLayer();
 
  941void QgsSymbolSelectorDialog::moveLayerByOffset( 
int offset )
 
  943  mSelectorWidget->moveLayerByOffset( offset );
 
  946void QgsSymbolSelectorDialog::setWidget( QWidget *widget )
 
  948  mSelectorWidget->setWidget( widget );
 
 1011void QgsSymbolSelectorDialog::showHelp()
 
 1016void QgsSymbolSelectorWidget::projectDataChanged()
 
 1018  mBlockModified = 
true;
 
 1021  mBlockModified = 
false;
 
 1024void QgsSymbolSelectorWidget::layersAboutToBeRemoved( 
const QList<QgsMapLayer *> &layers )
 
 1026  if ( mVectorLayer && layers.contains( mVectorLayer ) )
 
QFlags< SymbolLayerUserFlag > SymbolLayerUserFlags
Symbol layer user flags.
 
@ Millimeters
Millimeters.
 
@ FlagIncludeCrosshairsForMarkerSymbols
Include a crosshairs reference image in the background of marker symbol previews.
 
@ DisableSelectionRecoloring
If present, indicates that the symbol layer should not be recolored when rendering selected features.
 
static const double UI_SCALE_FACTOR
UI scaling factor.
 
static QgsSymbolLayerRegistry * symbolLayerRegistry()
Returns the application's symbol layer registry, used for managing symbol layers.
 
static QIcon getThemeIcon(const QString &name, const QColor &fillColor=QColor(), const QColor &strokeColor=QColor())
Helper to get a theme icon.
 
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images.
 
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
 
static QString iconPath(const QString &iconFile)
Returns path to the desired icon file.
 
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
 
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
 
Expression contexts are used to encapsulate the parameters around which a QgsExpression should be eva...
 
void appendScope(QgsExpressionContextScope *scope)
Appends a scope to the end of the context.
 
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
 
void appendScopes(const QList< QgsExpressionContextScope * > &scopes)
Appends a list of scopes to the end of the context.
 
Wrapper for iterator of features from vector data provider or vector layer.
 
bool nextFeature(QgsFeature &f)
Fetch next feature and stores in f, returns true on success.
 
This class wraps a request for features to a vector layer (or directly its vector data provider).
 
static void enableAutoGeometryRestore(QWidget *widget, const QString &key=QString())
Register the widget to allow its position to be automatically saved and restored when open and closed...
 
static void openHelp(const QString &key)
Opens help topic for the given help key using default system web browser.
 
void remoteImageFetched(const QString &url)
Emitted when the cache has finished retrieving an image file from a remote url.
 
A line symbol type, for rendering LineString and MultiLineString geometries.
 
QgsProperty dataDefinedWidth() const
Returns data defined width for whole symbol (including all symbol layers).
 
Struct for storing maximum and minimum scales for measurements in map units.
 
Abstract base class for marker symbol layers.
 
A marker symbol type, for rendering Point and MultiPoint geometries.
 
QgsProperty dataDefinedAngle() const
Returns data defined angle for whole symbol (including all symbol layers).
 
QgsProperty dataDefinedSize() const
Returns data defined size for whole symbol (including all symbol layers).
 
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
 
static QgsProject * instance()
Returns the QgsProject singleton instance.
 
void layersWillBeRemoved(const QStringList &layerIds)
Emitted when one or more layers are about to be removed from the registry.
 
void projectColorsChanged()
Emitted whenever the project's color scheme has been changed.
 
A store for object properties.
 
Stores properties relating to a screen.
 
void remoteSvgFetched(const QString &url)
Emitted when the cache has finished retrieving an SVG file from a remote url.
 
QgsSymbolLayerAbstractMetadata * symbolLayerMetadata(const QString &name) const
Returns metadata for specified symbol layer. Returns nullptr if not found.
 
static QgsSymbolLayer * defaultSymbolLayer(Qgis::SymbolType type)
create a new instance of symbol layer for specified symbol type with default settings
 
static QIcon symbolLayerPreviewIcon(const QgsSymbolLayer *layer, Qgis::RenderUnit u, QSize size, const QgsMapUnitScale &scale=QgsMapUnitScale(), Qgis::SymbolType parentSymbolType=Qgis::SymbolType::Hybrid, QgsMapLayer *mapLayer=nullptr, const QgsScreenProperties &screen=QgsScreenProperties())
Draws a symbol layer preview to an icon.
 
static QPixmap symbolPreviewPixmap(const QgsSymbol *symbol, QSize size, int padding=0, QgsRenderContext *customContext=nullptr, bool selected=false, const QgsExpressionContext *expressionContext=nullptr, const QgsLegendPatchShape *shape=nullptr, const QgsScreenProperties &screen=QgsScreenProperties())
Returns a pixmap preview for a color ramp.
 
static void resetSymbolLayerIds(QgsSymbol *symbol)
Regenerate recursively unique id from all symbol symbol layers.
 
virtual QgsSymbolLayer * clone() const =0
Shall be reimplemented by subclasses to create a deep copy of the instance.
 
Qgis::SymbolType type() const
 
bool isLocked() const
Returns true if the symbol layer colors are locked and the layer will ignore any symbol-level color c...
 
void setUserFlags(Qgis::SymbolLayerUserFlags flags)
Sets user-controlled flags which control the symbol layer's behavior.
 
virtual QgsSymbol * subSymbol()
Returns the symbol's sub symbol, if present.
 
Qgis::SymbolLayerUserFlags userFlags() const
Returns user-controlled flags which control the symbol layer's behavior.
 
void setLocked(bool locked)
Sets whether the layer's colors are locked.
 
void setContext(const QgsSymbolWidgetContext &context)
Sets the context in which the symbol widget is shown, e.g., the associated map canvas and expression ...
 
QgsSymbolSelectorDialog(QgsSymbol *symbol, QgsStyle *style, QgsVectorLayer *vl, QWidget *parent=nullptr, bool embedded=false)
Constructor for QgsSymbolSelectorDialog.
 
QgsSymbolWidgetContext context() const
Returns the context in which the symbol widget is shown, e.g., the associated map canvas and expressi...
 
QMenu * advancedMenu()
Returns menu for "advanced" button - create it if doesn't exist and show the advanced button.
 
void symbolChanged()
Slot to update tree when a new symbol from style.
 
QDialogButtonBox * buttonBox() const
Returns a reference to the dialog's button box.
 
QgsSymbol * symbol()
Returns the symbol that is currently active in the widget.
 
void keyPressEvent(QKeyEvent *e) override
 
void updateLayerPreview()
 
void duplicateLayer()
Duplicates the current symbol layer and places the duplicated layer above the current symbol layer.
 
void changeLayer(QgsSymbolLayer *layer)
alters tree and sets proper widget when Layer Type is changed
 
void loadSymbol(QgsSymbol *symbol, SymbolLayerItem *parent=nullptr)
Loads the given symbol into the widget.
 
Contains settings which reflect the context in which a symbol (or renderer) widget is shown,...
 
QgsExpressionContext * expressionContext() const
Returns the expression context used for the widget, if set.
 
Abstract base class for all rendered symbols.
 
QgsSymbolLayer * symbolLayer(int layer)
Returns the symbol layer at the specified index.
 
bool appendSymbolLayer(QgsSymbolLayer *layer)
Appends a symbol layer at the end of the current symbol layer list.
 
bool insertSymbolLayer(int index, QgsSymbolLayer *layer)
Inserts a symbol layer to specified index.
 
bool changeSymbolLayer(int index, QgsSymbolLayer *layer)
Deletes the current layer at the specified index and replaces it with layer.
 
QgsSymbolLayer * takeSymbolLayer(int index)
Removes a symbol layer from the list and returns a pointer to it.
 
virtual QgsSymbol * clone() const =0
Returns a deep copy of this symbol.
 
int symbolLayerCount() const
Returns the total number of symbol layers contained in the symbol.
 
Qgis::SymbolType type() const
Returns the symbol's type.
 
Represents a vector layer which manages a vector based data sets.
 
int scaleIconSize(int standardSize)
Scales an icon size to compensate for display pixel density, making the icon size hi-dpi friendly,...
 
#define Q_NOWARN_DEPRECATED_POP
 
#define Q_NOWARN_DEPRECATED_PUSH