56  mTargetScreenProperties = properties;
 
 
   61  return mTargetScreenProperties;
 
 
   70  : QAbstractItemModel( parent )
 
 
   86void QgsStyleModel::initStyleModel()
 
   91    mEntityNames.insert( entity, mStyle->
allNames( entity ) );
 
  115  if ( sIconGenerator )
 
  128  switch ( entityType )
 
  135      name = mEntityNames[ entityType ].value( 
index.row() - offsetForEntity( entityType ) );
 
  141    case Qt::DisplayRole:
 
  142    case Qt::ToolTipRole:
 
  145      switch ( 
index.column() )
 
  149          const QStringList tags = mStyle->
tagsOfSymbol( entityType, name );
 
  151          if ( role == Qt::ToolTipRole )
 
  153            QString tooltip = QStringLiteral( 
"<h3>%1</h3><p><i>%2</i>" ).arg( name,
 
  154                              tags.count() > 0 ? tags.join( QLatin1String( 
", " ) ) : tr( 
"Not tagged" ) );
 
  158            for ( 
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
 
  160              if ( !maxDevicePixelRatioScreen.
isValid() || it->devicePixelRatio() > maxDevicePixelRatioScreen.
devicePixelRatio() )
 
  161                maxDevicePixelRatioScreen = *it;
 
  164            switch ( entityType )
 
  169                std::unique_ptr< QgsSymbol > symbol( mStyle->
symbol( name ) );
 
  172                  int width = 
static_cast< int >( 
Qgis::UI_SCALE_FACTOR * QFontMetrics( 
data( 
index, Qt::FontRole ).value< QFont >() ).horizontalAdvance( 
'X' ) * 23 );
 
  173                  int height = 
static_cast< int >( width / 1.61803398875 ); 
 
  176                  QBuffer buffer( &
data );
 
  177                  pm.save( &buffer, 
"PNG", 100 );
 
  178                  tooltip += QStringLiteral( 
"<p><img src='data:image/png;base64, %3' width=\"%4\">" ).arg( QString( 
data.toBase64() ) ).arg( width );
 
  185                int width = 
static_cast< int >( 
Qgis::UI_SCALE_FACTOR * QFontMetrics( 
data( 
index, Qt::FontRole ).value< QFont >() ).horizontalAdvance( 
'X' ) * 23 );
 
  186                int height = 
static_cast< int >( width / 1.61803398875 ); 
 
  190                QBuffer buffer( &
data );
 
  191                pm.save( &buffer, 
"PNG", 100 );
 
  192                tooltip += QStringLiteral( 
"<p><img src='data:image/png;base64, %3' width=\"%4\">" ).arg( QString( 
data.toBase64() ) ).arg( width );
 
  198                int width = 
static_cast< int >( 
Qgis::UI_SCALE_FACTOR * QFontMetrics( 
data( 
index, Qt::FontRole ).value< QFont >() ).horizontalAdvance( 
'X' ) * 23 );
 
  199                int height = 
static_cast< int >( width / 1.61803398875 ); 
 
  203                QBuffer buffer( &
data );
 
  204                pm.save( &buffer, 
"PNG", 100 );
 
  205                tooltip += QStringLiteral( 
"<p><img src='data:image/png;base64, %3' width=\"%4\">" ).arg( QString( 
data.toBase64() ) ).arg( width );
 
  211                int width = 
static_cast< int >( 
Qgis::UI_SCALE_FACTOR * QFontMetrics( 
data( 
index, Qt::FontRole ).value< QFont >() ).horizontalAdvance( 
'X' ) * 23 );
 
  212                int height = 
static_cast< int >( width / 1.61803398875 ); 
 
  219                  QBuffer buffer( &
data );
 
  220                  pm.save( &buffer, 
"PNG", 100 );
 
  221                  tooltip += QStringLiteral( 
"<p><img src='data:image/png;base64, %3' width=\"%4\">" ).arg( QString( 
data.toBase64() ) ).arg( width );
 
  240          return mStyle->
tagsOfSymbol( entityType, name ).join( QLatin1String( 
", " ) );
 
  248    case Qt::DecorationRole:
 
  253      if ( !mExpressionContext )
 
  259        mExpressionContext = std::make_unique< QgsExpressionContext >();
 
  263      switch ( 
index.column() )
 
  266          switch ( entityType )
 
  271              QIcon icon = mIconCache[ entityType ].value( name );
 
  272              if ( !icon.isNull() )
 
  275              std::unique_ptr< QgsSymbol > symbol( mStyle->
symbol( name ) );
 
  278                for ( 
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
 
  280                  if ( mAdditionalSizes.isEmpty() )
 
  283                  for ( 
const QSize &s : mAdditionalSizes )
 
  290              mIconCache[ entityType ].insert( name, icon );
 
  296              QIcon icon = mIconCache[ entityType ].value( name );
 
  297              if ( !icon.isNull() )
 
  300              std::unique_ptr< QgsColorRamp > ramp( mStyle->
colorRamp( name ) );
 
  303                if ( mAdditionalSizes.isEmpty() )
 
  305                for ( 
const QSize &s : mAdditionalSizes )
 
  311              mIconCache[ entityType ].insert( name, icon );
 
  318              QIcon icon = mIconCache[ entityType ].value( name );
 
  319              if ( !icon.isNull() )
 
  323              for ( 
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
 
  325                if ( mAdditionalSizes.isEmpty() )
 
  327                for ( 
const QSize &s : mAdditionalSizes )
 
  332              mIconCache[ entityType ].insert( name, icon );
 
  339              QIcon icon = mIconCache[ entityType ].value( name );
 
  340              if ( !icon.isNull() )
 
  344              for ( 
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
 
  346                if ( mAdditionalSizes.isEmpty() )
 
  348                for ( 
const QSize &s : mAdditionalSizes )
 
  353              mIconCache[ entityType ].insert( name, icon );
 
  360              QIcon icon = mIconCache[ entityType ].value( name );
 
  361              if ( !icon.isNull() )
 
  367                for ( 
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
 
  371                    if ( mAdditionalSizes.isEmpty() )
 
  374                    for ( 
const QSize &s : mAdditionalSizes )
 
  381              mIconCache[ entityType ].insert( name, icon );
 
  391              QIcon icon = mIconCache[ entityType ].value( name );
 
  392              if ( !icon.isNull() )
 
  395              if ( sIconGenerator && !mPending3dSymbolIcons.contains( name ) )
 
  397                mPending3dSymbolIcons.insert( name );
 
  402              if ( mAdditionalSizes.isEmpty() )
 
  404              for ( 
const QSize &s : mAdditionalSizes )
 
  408              mIconCache[ entityType ].insert( name, icon );
 
  434      return mStyle->
isFavorite( entityType, name );
 
  438      switch ( entityType )
 
  443          return symbol ? 
static_cast< int >( symbol->
type() ) : QVariant();
 
  462      switch ( entityType )
 
  481      switch ( entityType )
 
  487          res.reserve( types.size() );
 
  490            res << static_cast< int >( type );
 
  511      return mStyle->
name();
 
 
  526  if ( 
index.row() < 0 || 
index.row() >= 
rowCount( QModelIndex() ) || role != Qt::EditRole )
 
  529  switch ( 
index.column() )
 
  535      switch ( entityType )
 
  542          name = mEntityNames[ entityType ].value( 
index.row() - offsetForEntity( entityType ) );
 
  546      const QString newName = value.toString();
 
  547      return mStyle->
renameEntity( entityType, name, newName );
 
 
  562  Qt::ItemFlags 
flags = QAbstractItemModel::flags( 
index );
 
  565    return flags | Qt::ItemIsEditable;
 
 
  575  return headerDataStatic( section, orientation, role );
 
 
  578QVariant QgsStyleModel::headerDataStatic( 
int section, Qt::Orientation orientation, 
int role )
 
  580  if ( role == Qt::DisplayRole )
 
  582    if ( orientation == Qt::Vertical ) 
 
  584      return QVariant( section );
 
  591          return QVariant( tr( 
"Name" ) );
 
  594          return QVariant( tr( 
"Tags" ) );
 
  609  if ( !hasIndex( row, column, 
parent ) )
 
  610    return QModelIndex();
 
  614    return createIndex( row, column );
 
  617  return QModelIndex();
 
 
  623  return QModelIndex();
 
 
  632      count += mEntityNames[ type ].size();
 
 
  645  if ( mAdditionalSizes.contains( size ) )
 
  648  mAdditionalSizes << size;
 
  650  if ( sIconGenerator )
 
 
  658  if ( mTargetScreenProperties.contains( properties ) )
 
  661  mTargetScreenProperties.insert( properties );
 
  663  if ( sIconGenerator )
 
 
  671  sIconGenerator = generator;
 
 
  677  mIconCache[ type ].remove( name );
 
  678  const QStringList newSymbolNames = mStyle->
allNames( type );
 
  681  const int newNameIndex = newSymbolNames.indexOf( name );
 
  682  if ( newNameIndex < 0 )
 
  685  const int offset = offsetForEntity( type );
 
  686  beginInsertRows( QModelIndex(), newNameIndex + offset, newNameIndex + offset );
 
  687  mEntityNames[ type ] = newSymbolNames;
 
  693  mIconCache[ type ].remove( name );
 
  694  const QStringList oldSymbolNames = mEntityNames[ type ];
 
  695  const QStringList newSymbolNames = mStyle->
allNames( type );
 
  698  const int oldNameIndex = oldSymbolNames.indexOf( name );
 
  699  if ( oldNameIndex < 0 )
 
  702  const int offset = offsetForEntity( type );
 
  703  beginRemoveRows( QModelIndex(), oldNameIndex + offset, oldNameIndex + offset );
 
  704  mEntityNames[ type ] = newSymbolNames;
 
  710  mIconCache[ type ].remove( name );
 
  712  const int offset = offsetForEntity( type );
 
  713  QModelIndex i = 
index( offset + mEntityNames[ type ].indexOf( name ), 
Tags );
 
  714  emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
 
  719  const int offset = offsetForEntity( type );
 
  720  QModelIndex i = 
index( offset + mEntityNames[ type ].indexOf( name ), 
Name );
 
  724void QgsStyleModel::onEntityRename( 
QgsStyle::StyleEntity type, 
const QString &oldName, 
const QString &newName )
 
  726  mIconCache[ type ].remove( oldName );
 
  727  const QStringList oldSymbolNames = mEntityNames[ type ];
 
  728  const QStringList newSymbolNames = mStyle->
allNames( type );
 
  731  const int oldNameIndex = oldSymbolNames.indexOf( oldName );
 
  732  if ( oldNameIndex < 0 )
 
  736  const int newNameIndex = newSymbolNames.indexOf( newName );
 
  737  if ( newNameIndex < 0 )
 
  740  if ( newNameIndex == oldNameIndex )
 
  742    mEntityNames[ type ] = newSymbolNames;
 
  746  const int offset = offsetForEntity( type );
 
  747  beginMoveRows( QModelIndex(), oldNameIndex + offset, oldNameIndex + offset, QModelIndex(), ( newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex ) + offset );
 
  748  mEntityNames[ type ] = newSymbolNames;
 
  752void QgsStyleModel::onTagsChanged( 
int entity, 
const QString &name, 
const QStringList & )
 
  755  int row = mEntityNames[type].indexOf( name ) + offsetForEntity( type );
 
  768void QgsStyleModel::rebuildSymbolIcons()
 
  771  mExpressionContext.reset();
 
  775    emit dataChanged( 
index( 0, 0 ), 
index( lastRow, 0 ), QVector<int>() << Qt::DecorationRole );
 
  779void QgsStyleModel::iconGenerated( 
QgsStyle::StyleEntity type, 
const QString &name, 
const QIcon &icon )
 
  781  int row = mEntityNames[type].indexOf( name ) + offsetForEntity( type );
 
  786      mPending3dSymbolIcons.remove( name );
 
  788      emit dataChanged( 
index( row, 0 ), 
index( row, 0 ) );
 
  804  int maxRowForEntity = 0;
 
  807    maxRowForEntity += mEntityNames[ type ].size();
 
  808    if ( row < maxRowForEntity )
 
  822    if ( type == entity )
 
  825    offset += mEntityNames[ type ].size();
 
  835  : QSortFilterProxyModel( parent )
 
  839  setSourceModel( mModel );
 
 
  843void QgsStyleProxyModel::initialize()
 
  845  setSortCaseSensitivity( Qt::CaseInsensitive );
 
  847  setDynamicSortFilter( 
true );
 
  857      if ( mSmartGroupId >= 0 )
 
  873      if ( mSmartGroupId >= 0 )
 
  880  : QSortFilterProxyModel( parent )
 
  882  , mStyle( model->style() )
 
  884  setSourceModel( mModel );
 
 
  889  : QSortFilterProxyModel( parent )
 
  890  , mCombinedModel( model )
 
  892  setSourceModel( mCombinedModel );
 
 
  898  if ( mFilterString.isEmpty()  && !mEntityFilterEnabled && !mSymbolTypeFilterEnabled && mTagId < 0 && mSmartGroupId < 0 && !mFavoritesOnly && mTagFilter.isEmpty() )
 
  901  const QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
 
  906  const QString name = sourceModel()->data( index ).toString();
 
  910  if ( mEntityFilterEnabled && ( mEntityFilters.empty() || !mEntityFilters.contains( styleEntityType ) ) )
 
  914  if ( mSymbolTypeFilterEnabled && 
symbolType != mSymbolType )
 
  919    switch ( styleEntityType )
 
  939        if ( !types.empty() && !types.contains( QVariant::fromValue( mLayerType ) ) )
 
  946  if ( mTagId >= 0 && !mTaggedSymbolNames.contains( name ) )
 
  949  if ( mSmartGroupId >= 0 && !mSmartGroupSymbolNames.contains( name ) )
 
  952  if ( !mTagFilter.isEmpty() && !tags.contains( mTagFilter, Qt::CaseInsensitive ) )
 
  958  if ( !mFilterString.isEmpty() )
 
  962    const QStringList partsToMatch = mFilterString.trimmed().split( 
' ' );
 
  964    QStringList partsToSearch = name.split( 
' ' );
 
  965    for ( 
const QString &tag : tags )
 
  967      partsToSearch.append( tag.split( 
' ' ) );
 
  970    for ( 
const QString &part : partsToMatch )
 
  973      for ( 
const QString &partToSearch : std::as_const( partsToSearch ) )
 
  975        if ( partToSearch.contains( part, Qt::CaseInsensitive ) )
 
 
  993  if ( leftSource != rightSource )
 
  994    return QString::localeAwareCompare( leftSource, rightSource ) < 0;
 
  998  return QString::localeAwareCompare( leftName, rightName ) < 0;
 
 
 1003  mFilterString = filter;
 
 
 1010  return mFavoritesOnly;
 
 
 1023  if ( mCombinedModel )
 
 
 1031  if ( mCombinedModel )
 
 
 1037  return mSymbolTypeFilterEnabled;
 
 
 1042  mSymbolTypeFilterEnabled = enabled;
 
 
 1063  mTaggedSymbolNames.clear();
 
 1067      mTaggedSymbolNames.append( mStyle->
symbolsWithTag( entity, mTagId ) );
 
 
 1097  mSmartGroupSymbolNames.clear();
 
 1098  if ( mSmartGroupId >= 0 )
 
 
 1109  return mSmartGroupId;
 
 
 1125  return mEntityFilterEnabled;
 
 
 1141  mEntityFilters = QList< QgsStyle::StyleEntity >() << 
entityFilter;
 
 
 1147  mEntityFilters = filters;
 
 
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
 
static const double UI_SCALE_FACTOR
UI scaling factor.
 
An abstract base class for icon generators for a QgsStyleModel.
 
void setTargetScreenProperties(const QSet< QgsScreenProperties > &properties)
Sets the target screen properties to use when generating icons.
 
void setIconSizes(const QList< QSize > &sizes)
Sets the list of icon sizes to generate.
 
virtual void generateIcon(QgsStyle *style, QgsStyle::StyleEntity type, const QString &name)=0
Triggers generation of an icon for an entity from the specified style database, with matching entity ...
 
QgsAbstractStyleEntityIconGenerator(QObject *parent)
Constructor for QgsAbstractStyleEntityIconGenerator, with the specified parent object.
 
QSet< QgsScreenProperties > targetScreenProperties() const
Returns the target screen properties to use when generating icons.
 
QList< QSize > iconSizes() const
Returns the list of icon sizes to generate.
 
void iconGenerated(QgsStyle::StyleEntity type, const QString &name, const QIcon &icon)
Emitted when the icon for the style entity with matching type and name has been generated.
 
static QString defaultThemePath()
Returns the path to the default theme directory.
 
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 QgsStyleModel * defaultStyleModel()
Returns a shared QgsStyleModel containing the default style library (see QgsStyle::defaultStyle()).
 
A model which contains entities from multiple QgsStyle databases.
 
void addTargetScreenProperties(const QgsScreenProperties &properties)
Adds additional target screen properties to use when generating icons for Qt::DecorationRole data.
 
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
 
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
 
void remoteImageFetched(const QString &url)
Emitted when the cache has finished retrieving an image file from a remote url.
 
Represents a patch shape for use in map legends.
 
bool isNull() const
Returns true if the patch shape is a null QgsLegendPatchShape, which indicates that the default legen...
 
Contains settings for how a map layer will be labeled.
 
static QPixmap labelSettingsPreviewPixmap(const QgsPalLayerSettings &settings, QSize size, const QString &previewText=QString(), int padding=0, const QgsScreenProperties &screen=QgsScreenProperties())
Returns a pixmap preview for label settings.
 
Stores properties relating to a screen.
 
double devicePixelRatio() const
Returns the ratio between physical pixels and device-independent pixels for the screen.
 
bool isValid() const
Returns true if the properties are valid.
 
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
 
@ IsFavorite
Whether entity is flagged as a favorite.
 
@ EntityName
Entity name (since QGIS 3.26)
 
@ LayerType
Layer type (for label settings entities)
 
@ IsTitle
True if the index corresponds to a title item (since QGIS 3.26)
 
@ SymbolType
Symbol type (for symbol or legend patch shape entities)
 
@ StyleFileName
File name of associated QgsStyle (QgsStyle::fileName()) (since QGIS 3.26)
 
@ Type
Style entity type, see QgsStyle::StyleEntity.
 
@ CompatibleGeometryTypes
Compatible layer geometry types (for 3D symbols)
 
@ Tag
String list of tags.
 
@ StyleName
Name of associated QgsStyle (QgsStyle::name()) (since QGIS 3.26)
 
Qt::ItemFlags flags(const QModelIndex &index) const override
 
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
 
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
 
int columnCount(const QModelIndex &parent=QModelIndex()) const override
 
QVariant data(const QModelIndex &index, int role) const override
 
static void setIconGenerator(QgsAbstractStyleEntityIconGenerator *generator)
Sets the icon generator to use for deferred style entity icon generation.
 
int rowCount(const QModelIndex &parent=QModelIndex()) const override
 
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
 
QModelIndex parent(const QModelIndex &index) const override
 
void addTargetScreenProperties(const QgsScreenProperties &properties)
Adds additional target screen properties to use when generating icons for Qt::DecorationRole data.
 
QgsStyleModel(QgsStyle *style, QObject *parent=nullptr)
Constructor for QgsStyleModel, for the specified style and parent object.
 
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
 
void setEntityFilter(QgsStyle::StyleEntity filter)
Sets the style entity type filter.
 
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
 
bool favoritesOnly() const
Returns true if the model is showing only favorited entities.
 
void setSymbolTypeFilterEnabled(bool enabled)
Sets whether filtering by symbol type is enabled.
 
void setTagId(int id)
Sets a tag id to filter style entities by.
 
QString tagString() const
Returns the tag string used to filter style entities by.
 
Qgis::SymbolType symbolType() const
Returns the symbol type filter.
 
void setTagString(const QString &tag)
Sets a tag to filter style entities by.
 
QgsStyle::StyleEntity entityFilter() const
Returns the style entity type filter.
 
QgsStyleProxyModel(QgsStyle *style, QObject *parent=nullptr)
Constructor for QgsStyleProxyModel, for the specified style and parent object.
 
int tagId() const
Returns the tag id used to filter style entities by.
 
void setEntityFilters(const QList< QgsStyle::StyleEntity > &filters)
Sets the style entity type filters.
 
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
 
void setFavoritesOnly(bool favoritesOnly)
Sets whether the model should show only favorited entities.
 
void setSymbolType(Qgis::SymbolType type)
Sets the symbol type filter.
 
bool entityFilterEnabled() const
Returns true if filtering by entity type is enabled.
 
Qgis::GeometryType layerType() const
Returns the layer type filter, or Qgis::GeometryType::Unknown if no layer type filter is present.
 
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
 
void addTargetScreenProperties(const QgsScreenProperties &properties)
Adds additional target screen properties to use when generating icons for Qt::DecorationRole data.
 
void setEntityFilterEnabled(bool enabled)
Sets whether filtering by entity type is enabled.
 
void setSmartGroupId(int id)
Sets a smart group id to filter style entities by.
 
bool symbolTypeFilterEnabled() const
Returns true if filtering by symbol type is enabled.
 
int smartGroupId() const
Returns the smart group id used to filter style entities by.
 
void setFilterString(const QString &filter)
Sets a filter string, such that only symbol entities with names matching the specified string will be...
 
void setLayerType(Qgis::GeometryType type)
Sets the layer type filter.
 
QgsTextFormat textFormat(const QString &name) const
Returns the text format with the specified name.
 
QStringList allNames(StyleEntity type) const
Returns a list of the names of all existing entities of the specified type.
 
void entityChanged(QgsStyle::StyleEntity entity, const QString &name)
Emitted whenever an entity's definition is changed.
 
void rebuildIconPreviews()
Emitted whenever icon previews for entities in the style must be rebuilt.
 
QStringList symbolsWithTag(StyleEntity type, int tagid) const
Returns the symbol names with which have the given tag.
 
QgsSymbol * symbol(const QString &name)
Returns a NEW copy of symbol.
 
QStringList symbolsOfSmartgroup(StyleEntity type, int id)
Returns the symbols for the smartgroup.
 
StyleEntity
Enum for Entities involved in a style.
 
@ LabelSettingsEntity
Label settings.
 
@ TextFormatEntity
Text formats.
 
@ SmartgroupEntity
Smart groups.
 
@ Symbol3DEntity
3D symbol entity (since QGIS 3.14)
 
@ ColorrampEntity
Color ramps.
 
@ LegendPatchShapeEntity
Legend patch shape (since QGIS 3.14)
 
QStringList tagsOfSymbol(StyleEntity type, const QString &symbol)
Returns the tags associated with the symbol.
 
QList< Qgis::GeometryType > symbol3DCompatibleGeometryTypes(const QString &name) const
Returns the list of the vector layer geometry types which are compatible with the 3D symbol with the ...
 
void entityRenamed(QgsStyle::StyleEntity entity, const QString &oldName, const QString &newName)
Emitted whenever a entity of the specified type has been renamed from oldName to newName.
 
const QgsSymbol * symbolRef(const QString &name) const
Returns a const pointer to a symbol (doesn't create new instance)
 
void initialized()
Emitted when the style database has been fully initialized.
 
QString fileName() const
Returns the current file name of the style database.
 
bool isInitialized() const
Returns true if the style is initialized and ready for use.
 
QgsColorRamp * colorRamp(const QString &name) const
Returns a new copy of the specified color ramp.
 
bool renameEntity(StyleEntity type, const QString &oldName, const QString &newName)
Renames an entity of the specified type from oldName to newName.
 
bool isFavorite(StyleEntity type, const QString &name)
Returns true if the symbol with matching type and name is marked as a favorite.
 
QString name() const
Returns the name of the style.
 
Qgis::GeometryType labelSettingsLayerType(const QString &name) const
Returns the layer geometry type corresponding to the label settings with the specified name,...
 
void entityTagsChanged(QgsStyle::StyleEntity entity, const QString &name, const QStringList &newTags)
Emitted whenever an entity's tags are changed.
 
void favoritedChanged(QgsStyle::StyleEntity entity, const QString &name, bool isFavorite)
Emitted whenever an entity is either favorited or un-favorited.
 
QgsPalLayerSettings labelSettings(const QString &name) const
Returns the label settings with the specified name.
 
void entityRemoved(QgsStyle::StyleEntity entity, const QString &name)
Emitted whenever an entity of the specified type is removed from the style and the database has been ...
 
Qgis::SymbolType legendPatchShapeSymbolType(const QString &name) const
Returns the symbol type corresponding to the legend patch shape with the specified name,...
 
const QgsSymbol * previewSymbolForPatchShape(const QgsLegendPatchShape &shape) const
Returns a symbol to use for rendering preview icons for a patch shape.
 
QgsLegendPatchShape legendPatchShape(const QString &name) const
Returns the legend patch shape with the specified name.
 
void entityAdded(QgsStyle::StyleEntity entity, const QString &name)
Emitted every time a new entity has been added to the database.
 
void remoteSvgFetched(const QString &url)
Emitted when the cache has finished retrieving an SVG file from a remote url.
 
static QPixmap colorRampPreviewPixmap(QgsColorRamp *ramp, QSize size, int padding=0, Qt::Orientation direction=Qt::Horizontal, bool flipDirection=false, bool drawTransparentBackground=true)
Returns a pixmap preview for a color ramp.
 
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.
 
Abstract base class for all rendered symbols.
 
Qgis::SymbolType type() const
Returns the symbol's type.
 
Container for all settings relating to text rendering.
 
static QPixmap textFormatPreviewPixmap(const QgsTextFormat &format, QSize size, const QString &previewText=QString(), int padding=0, const QgsScreenProperties &screen=QgsScreenProperties())
Returns a pixmap preview for a text format.
 
const double ICON_PADDING_FACTOR