33#include "moc_qgsstylemodel.cpp"
35using namespace Qt::StringLiterals;
64 mTargetScreenProperties = properties;
69 return mTargetScreenProperties;
78 : QAbstractItemModel(
parent )
83 if ( mStyle->isInitialized() )
94void QgsStyleModel::initStyleModel()
99 mEntityNames.insert( entity, mStyle->
allNames( entity ) );
105 mTargetScreenProperties.insert( QgsScreenProperties() );
123 if ( sIconGenerator )
136 switch ( entityType )
143 name = mEntityNames[entityType].value(
index.row() - offsetForEntity( entityType ) );
149 case Qt::DisplayRole:
150 case Qt::ToolTipRole:
153 switch (
index.column() )
157 const QStringList tags = mStyle->tagsOfSymbol( entityType, name );
159 if ( role == Qt::ToolTipRole )
161 QString tooltip = u
"<h3>%1</h3><p><i>%2</i>"_s.arg( name, tags.count() > 0 ? tags.join(
", "_L1 ) : tr(
"Not tagged" ) );
165 for (
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
167 if ( !maxDevicePixelRatioScreen.
isValid() || it->devicePixelRatio() > maxDevicePixelRatioScreen.
devicePixelRatio() )
168 maxDevicePixelRatioScreen = *it;
171 switch ( entityType )
176 std::unique_ptr< QgsSymbol > symbol( mStyle->symbol( name ) );
179 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data(
index, Qt::FontRole ).value< QFont >() ).horizontalAdvance(
'X' ) * 23 );
180 int height =
static_cast< int >( width / 1.61803398875 );
183 QBuffer buffer( &
data );
184 pm.save( &buffer,
"PNG", 100 );
185 tooltip += u
"<p><img src='data:image/png;base64, %3' width=\"%4\">"_s.arg( QString(
data.toBase64() ) ).arg( width );
192 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data(
index, Qt::FontRole ).value< QFont >() ).horizontalAdvance(
'X' ) * 23 );
193 int height =
static_cast< int >( width / 1.61803398875 );
197 QBuffer buffer( &
data );
198 pm.save( &buffer,
"PNG", 100 );
199 tooltip += u
"<p><img src='data:image/png;base64, %3' width=\"%4\">"_s.arg( QString(
data.toBase64() ) ).arg( width );
205 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data(
index, Qt::FontRole ).value< QFont >() ).horizontalAdvance(
'X' ) * 23 );
206 int height =
static_cast< int >( width / 1.61803398875 );
210 QBuffer buffer( &
data );
211 pm.save( &buffer,
"PNG", 100 );
212 tooltip += u
"<p><img src='data:image/png;base64, %3' width=\"%4\">"_s.arg( QString(
data.toBase64() ) ).arg( width );
218 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data(
index, Qt::FontRole ).value< QFont >() ).horizontalAdvance(
'X' ) * 23 );
219 int height =
static_cast< int >( width / 1.61803398875 );
222 if (
const QgsSymbol *symbol = mStyle->previewSymbolForPatchShape( shape ) )
226 QBuffer buffer( &
data );
227 pm.save( &buffer,
"PNG", 100 );
228 tooltip += u
"<p><img src='data:image/png;base64, %3' width=\"%4\">"_s.arg( QString(
data.toBase64() ) ).arg( width );
248 return mStyle->tagsOfSymbol( entityType, name ).join(
", "_L1 );
256 case Qt::DecorationRole:
261 if ( !mExpressionContext )
267 mExpressionContext = std::make_unique< QgsExpressionContext >();
271 switch (
index.column() )
274 switch ( entityType )
279 QIcon icon = mIconCache[entityType].value( name );
280 if ( !icon.isNull() )
283 std::unique_ptr< QgsSymbol > symbol( mStyle->symbol( name ) );
286 for (
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
288 if ( mAdditionalSizes.isEmpty() )
291 for (
const QSize &s : mAdditionalSizes )
299 mIconCache[entityType].insert( name, icon );
305 QIcon icon = mIconCache[entityType].value( name );
306 if ( !icon.isNull() )
309 std::unique_ptr< QgsColorRamp > ramp( mStyle->colorRamp( name ) );
312 if ( mAdditionalSizes.isEmpty() )
314 for (
const QSize &s : mAdditionalSizes )
319 mIconCache[entityType].insert( name, icon );
326 QIcon icon = mIconCache[entityType].value( name );
327 if ( !icon.isNull() )
331 for (
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
333 if ( mAdditionalSizes.isEmpty() )
335 for (
const QSize &s : mAdditionalSizes )
340 mIconCache[entityType].insert( name, icon );
347 QIcon icon = mIconCache[entityType].value( name );
348 if ( !icon.isNull() )
352 for (
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
354 if ( mAdditionalSizes.isEmpty() )
356 for (
const QSize &s : mAdditionalSizes )
361 mIconCache[entityType].insert( name, icon );
368 QIcon icon = mIconCache[entityType].value( name );
369 if ( !icon.isNull() )
375 for (
auto it = mTargetScreenProperties.constBegin(); it != mTargetScreenProperties.constEnd(); ++it )
377 if (
const QgsSymbol *symbol = mStyle->previewSymbolForPatchShape( shape ) )
379 if ( mAdditionalSizes.isEmpty() )
382 for (
const QSize &s : mAdditionalSizes )
389 mIconCache[entityType].insert( name, icon );
400 QIcon icon = mIconCache[entityType].value( name );
401 if ( !icon.isNull() )
406 if ( sIconGenerator && !mPending3dSymbolIcons.contains( name ) )
408 mPending3dSymbolIcons.insert( name );
409 sIconGenerator->generateIcon( mStyle, entityType, name );
414 if ( sIconGenerator && !mPendingMaterialSettingsIcons.contains( name ) )
416 mPendingMaterialSettingsIcons.insert( name );
417 sIconGenerator->generateIcon( mStyle, entityType, name );
422 if ( mAdditionalSizes.isEmpty() )
424 for (
const QSize &s : mAdditionalSizes )
428 mIconCache[entityType].insert( name, icon );
451 return mStyle->tagsOfSymbol( entityType, name );
454 return mStyle->isFavorite( entityType, name );
458 switch ( entityType )
462 const QgsSymbol *symbol = mStyle->symbolRef( name );
463 return symbol ?
static_cast< int >( symbol->
type() ) : QVariant();
467 return static_cast< int >( mStyle->legendPatchShapeSymbolType( name ) );
483 switch ( entityType )
486 return static_cast< int >( mStyle->labelSettingsLayerType( name ) );
503 switch ( entityType )
508 const QList< Qgis::GeometryType > types = mStyle->symbol3DCompatibleGeometryTypes( name );
509 res.reserve( types.size() );
512 res << static_cast< int >( type );
532 switch ( entityType )
536 std::unique_ptr< QgsAbstractMaterialSettings > settings = mStyle->materialSettings( name );
537 return settings ? settings->type() : QVariant();
557 return mStyle->name();
560 return mStyle->fileName();
572 if (
index.row() < 0 ||
index.row() >=
rowCount( QModelIndex() ) || role != Qt::EditRole )
575 switch (
index.column() )
581 switch ( entityType )
588 name = mEntityNames[entityType].value(
index.row() - offsetForEntity( entityType ) );
592 const QString newName = value.toString();
593 return mStyle->renameEntity( entityType, name, newName );
608 Qt::ItemFlags
flags = QAbstractItemModel::flags(
index );
611 return flags | Qt::ItemIsEditable;
621 return headerDataStatic( section, orientation, role );
624QVariant QgsStyleModel::headerDataStatic(
int section, Qt::Orientation orientation,
int role )
626 if ( role == Qt::DisplayRole )
628 if ( orientation == Qt::Vertical )
630 return QVariant( section );
637 return QVariant( tr(
"Name" ) );
640 return QVariant( tr(
"Tags" ) );
655 if ( !hasIndex( row, column,
parent ) )
656 return QModelIndex();
660 return createIndex( row, column );
663 return QModelIndex();
669 return QModelIndex();
678 count +=
static_cast< int >( mEntityNames[type].size() );
691 if ( mAdditionalSizes.contains( size ) )
694 mAdditionalSizes << size;
696 if ( sIconGenerator )
697 sIconGenerator->setIconSizes( mAdditionalSizes );
704 if ( mTargetScreenProperties.contains( properties ) )
707 mTargetScreenProperties.insert( properties );
709 if ( sIconGenerator )
710 sIconGenerator->setTargetScreenProperties( mTargetScreenProperties );
717 sIconGenerator = generator;
723 mIconCache[type].remove( name );
724 const QStringList newSymbolNames = mStyle->
allNames( type );
727 const int newNameIndex =
static_cast< int >( newSymbolNames.indexOf( name ) );
728 if ( newNameIndex < 0 )
731 const int offset = offsetForEntity( type );
732 beginInsertRows( QModelIndex(), newNameIndex + offset, newNameIndex + offset );
733 mEntityNames[type] = newSymbolNames;
739 mIconCache[type].remove( name );
740 const QStringList oldSymbolNames = mEntityNames[type];
741 const QStringList newSymbolNames = mStyle->allNames( type );
744 const int oldNameIndex =
static_cast< int >( oldSymbolNames.indexOf( name ) );
745 if ( oldNameIndex < 0 )
748 const int offset = offsetForEntity( type );
749 beginRemoveRows( QModelIndex(), oldNameIndex + offset, oldNameIndex + offset );
750 mEntityNames[type] = newSymbolNames;
756 mIconCache[type].remove( name );
758 const int offset = offsetForEntity( type );
759 QModelIndex i =
index( offset +
static_cast< int >( mEntityNames[type].indexOf( name ) ),
Tags );
760 emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
765 const int offset = offsetForEntity( type );
766 QModelIndex i =
index( offset +
static_cast< int >( mEntityNames[type].indexOf( name ) ),
Name );
770void QgsStyleModel::onEntityRename(
QgsStyle::StyleEntity type,
const QString &oldName,
const QString &newName )
772 mIconCache[type].remove( oldName );
773 const QStringList oldSymbolNames = mEntityNames[type];
774 const QStringList newSymbolNames = mStyle->allNames( type );
777 const int oldNameIndex =
static_cast< int >( oldSymbolNames.indexOf( oldName ) );
778 if ( oldNameIndex < 0 )
782 const int newNameIndex =
static_cast< int >( newSymbolNames.indexOf( newName ) );
783 if ( newNameIndex < 0 )
786 if ( newNameIndex == oldNameIndex )
788 mEntityNames[type] = newSymbolNames;
792 const int offset = offsetForEntity( type );
793 beginMoveRows( QModelIndex(), oldNameIndex + offset, oldNameIndex + offset, QModelIndex(), ( newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex ) + offset );
794 mEntityNames[type] = newSymbolNames;
798void QgsStyleModel::onTagsChanged(
int entity,
const QString &name,
const QStringList & )
801 int row =
static_cast< int >( mEntityNames[type].indexOf( name ) ) + offsetForEntity( type );
814void QgsStyleModel::rebuildSymbolIcons()
817 mExpressionContext.reset();
821 emit dataChanged(
index( 0, 0 ),
index( lastRow, 0 ), QVector<int>() << Qt::DecorationRole );
825void QgsStyleModel::iconGenerated(
QgsStyle::StyleEntity type,
const QString &name,
const QIcon &icon )
827 int row =
static_cast< int >( mEntityNames[type].indexOf( name ) ) + offsetForEntity( type );
832 mPending3dSymbolIcons.remove( name );
834 emit dataChanged(
index( row, 0 ),
index( row, 0 ) );
838 mPendingMaterialSettingsIcons.remove( name );
840 emit dataChanged(
index( row, 0 ),
index( row, 0 ) );
856 int maxRowForEntity = 0;
859 maxRowForEntity +=
static_cast< int >( mEntityNames[type].size() );
860 if ( row < maxRowForEntity )
874 if ( type == entity )
877 offset +=
static_cast< int >( mEntityNames[type].size() );
887 : QSortFilterProxyModel( parent )
891 setSourceModel( mModel );
895void QgsStyleProxyModel::initialize()
897 setSortCaseSensitivity( Qt::CaseInsensitive );
899 setDynamicSortFilter(
true );
908 if ( mSmartGroupId >= 0 )
923 if ( mSmartGroupId >= 0 )
931 return mRenderingTechnique;
936 if ( mRenderingTechnique == technique )
939 mRenderingTechnique = technique;
944 : QSortFilterProxyModel( parent )
946 , mStyle( model->style() )
948 setSourceModel( mModel );
953 : QSortFilterProxyModel( parent )
954 , mCombinedModel( model )
956 setSourceModel( mCombinedModel );
962 if ( mFilterString.isEmpty() && !mEntityFilterEnabled && !mSymbolTypeFilterEnabled && !mRenderingTechniqueFilterEnabled && mTagId < 0 && mSmartGroupId < 0 && !mFavoritesOnly && mTagFilter.isEmpty() )
965 const QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
970 const QString name = sourceModel()->data( index ).toString();
974 if ( mEntityFilterEnabled && ( mEntityFilters.empty() || !mEntityFilters.contains( styleEntityType ) ) )
978 if ( mSymbolTypeFilterEnabled &&
symbolType != mSymbolType )
983 switch ( styleEntityType )
1004 if ( !types.empty() && !types.contains( QVariant::fromValue( mLayerType ) ) )
1011 if ( mTagId >= 0 && !mTaggedSymbolNames.contains( name ) )
1014 if ( mSmartGroupId >= 0 && !mSmartGroupSymbolNames.contains( name ) )
1017 if ( !mTagFilter.isEmpty() && !tags.contains( mTagFilter, Qt::CaseInsensitive ) )
1023 if ( !mFilterString.isEmpty() )
1027 const QStringList partsToMatch = mFilterString.trimmed().split(
' ' );
1029 QStringList partsToSearch = name.split(
' ' );
1030 for (
const QString &tag : tags )
1032 partsToSearch.append( tag.split(
' ' ) );
1035 for (
const QString &part : partsToMatch )
1038 for (
const QString &partToSearch : std::as_const( partsToSearch ) )
1040 if ( partToSearch.contains( part, Qt::CaseInsensitive ) )
1054 if ( !materialType.isEmpty() )
1058 if ( !metadata->supportsTechnique( mRenderingTechnique ) )
1071 if ( leftSource != rightSource )
1072 return QString::localeAwareCompare( leftSource, rightSource ) < 0;
1076 return QString::localeAwareCompare( leftName, rightName ) < 0;
1081 mFilterString = filter;
1088 return mFavoritesOnly;
1100 mModel->addDesiredIconSize( size );
1101 if ( mCombinedModel )
1102 mCombinedModel->addDesiredIconSize( size );
1108 mModel->addTargetScreenProperties( properties );
1109 if ( mCombinedModel )
1110 mCombinedModel->addTargetScreenProperties( properties );
1115 return mSymbolTypeFilterEnabled;
1120 mSymbolTypeFilterEnabled = enabled;
1137 return mRenderingTechniqueFilterEnabled;
1142 if ( mRenderingTechniqueFilterEnabled == enabled )
1145 mRenderingTechniqueFilterEnabled = enabled;
1155 mTaggedSymbolNames.clear();
1159 mTaggedSymbolNames.append( mStyle->symbolsWithTag( entity, mTagId ) );
1189 mSmartGroupSymbolNames.clear();
1190 if ( mSmartGroupId >= 0 )
1193 mSmartGroupSymbolNames.append( mStyle->symbolsOfSmartgroup( entity, mSmartGroupId ) );
1201 return mSmartGroupId;
1217 return mEntityFilterEnabled;
1233 mEntityFilters = QList< QgsStyle::StyleEntity >() <<
entityFilter;
1239 mEntityFilters = filters;
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
MaterialRenderingTechnique
Material rendering techniques.
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.
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 QgsMaterialRegistry * materialRegistry()
Returns registry of available 3D materials.
static QgsStyleModel * defaultStyleModel()
Returns a shared QgsStyleModel containing the default style library (see QgsStyle::defaultStyle()).
A model which contains entities from multiple QgsStyle databases.
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.
@ LayerType
Layer type (for label settings entities).
@ IsTitle
True if the index corresponds to a title item.
@ SymbolType
Symbol type (for symbol or legend patch shape entities).
@ MaterialType
Material type (for material entities).
@ StyleFileName
File name of associated QgsStyle (QgsStyle::fileName()).
@ 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()).
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.
QgsStyle * style()
Returns the style managed by the model.
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
void setRenderingTechniqueFilterEnabled(bool enabled)
Sets whether filtering by material rendering technique is enabled.
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.
void setRenderingTechnique(Qgis::MaterialRenderingTechnique technique)
Sets the rendering technique filter.
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.
Qgis::MaterialRenderingTechnique renderingTechnique() const
Returns the rendering technique filter.
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...
bool renderingTechniqueFilterEnabled() const
Returns true if filtering by material rendering technique is enabled.
void setLayerType(Qgis::GeometryType type)
Sets the layer type filter.
A database of saved style entities, including symbols, color ramps, text formats and others.
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.
StyleEntity
Enum for Entities involved in a style.
@ LabelSettingsEntity
Label settings.
@ TextFormatEntity
Text formats.
@ SmartgroupEntity
Smart groups.
@ Symbol3DEntity
3D symbol entity
@ ColorrampEntity
Color ramps.
@ LegendPatchShapeEntity
Legend patch shape.
@ MaterialSettingsEntity
Material settings.
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.
void initialized()
Emitted when the style database has been fully initialized.
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.
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 ...
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