29 : QAbstractItemModel( parent )
75 if ( index.row() < 0 || index.row() >=
rowCount( QModelIndex() ) )
85 name = mSymbolNames.value( index.row() );
89 name = mRampNames.value( index.row() - mSymbolNames.size() );
93 name = mTextFormatNames.value( index.row() - mSymbolNames.size() - mRampNames.size() );
97 name = mLabelSettingsNames.value( index.row() - mSymbolNames.size() - mRampNames.size() - mTextFormatNames.size() );
107 case Qt::DisplayRole:
108 case Qt::ToolTipRole:
111 switch ( index.column() )
115 const QStringList tags = mStyle->
tagsOfSymbol( entityType, name );
117 if ( role == Qt::ToolTipRole )
119 QString tooltip = QStringLiteral(
"<h3>%1</h3><p><i>%2</i>" ).arg( name,
120 tags.count() > 0 ? tags.join( QStringLiteral(
", " ) ) : tr(
"Not tagged" ) );
122 switch ( entityType )
127 std::unique_ptr< QgsSymbol > symbol( mStyle->
symbol( name ) );
130 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data( index, Qt::FontRole ).value< QFont >() ).width(
'X' ) * 23 );
131 int height =
static_cast< int >( width / 1.61803398875 );
134 QBuffer buffer( &data );
135 pm.save( &buffer,
"PNG", 100 );
136 tooltip += QStringLiteral(
"<p><img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) );
143 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data( index, Qt::FontRole ).value< QFont >() ).width(
'X' ) * 23 );
144 int height =
static_cast< int >( width / 1.61803398875 );
148 QBuffer buffer( &data );
149 pm.save( &buffer,
"PNG", 100 );
150 tooltip += QStringLiteral(
"<p><img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) );
156 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data( index, Qt::FontRole ).value< QFont >() ).width(
'X' ) * 23 );
157 int height =
static_cast< int >( width / 1.61803398875 );
161 QBuffer buffer( &data );
162 pm.save( &buffer,
"PNG", 100 );
163 tooltip += QStringLiteral(
"<p><img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) );
180 return mStyle->
tagsOfSymbol( entityType, name ).join( QStringLiteral(
", " ) );
185 case Qt::DecorationRole:
190 if ( !mExpressionContext )
196 mExpressionContext = qgis::make_unique< QgsExpressionContext >();
200 switch ( index.column() )
203 switch ( entityType )
208 QIcon icon = mSymbolIconCache.value( name );
209 if ( !icon.isNull() )
212 std::unique_ptr< QgsSymbol > symbol( mStyle->
symbol( name ) );
215 if ( mAdditionalSizes.isEmpty() )
218 for (
const QSize &s : mAdditionalSizes )
224 mSymbolIconCache.insert( name, icon );
230 QIcon icon = mColorRampIconCache.value( name );
231 if ( !icon.isNull() )
234 std::unique_ptr< QgsColorRamp > ramp( mStyle->
colorRamp( name ) );
237 if ( mAdditionalSizes.isEmpty() )
239 for (
const QSize &s : mAdditionalSizes )
245 mColorRampIconCache.insert( name, icon );
252 QIcon icon = mTextFormatIconCache.value( name );
253 if ( !icon.isNull() )
257 if ( mAdditionalSizes.isEmpty() )
259 for (
const QSize &s : mAdditionalSizes )
263 mTextFormatIconCache.insert( name, icon );
270 QIcon icon = mLabelSettingsIconCache.value( name );
271 if ( !icon.isNull() )
275 if ( mAdditionalSizes.isEmpty() )
277 for (
const QSize &s : mAdditionalSizes )
281 mLabelSettingsIconCache.insert( name, icon );
304 return mStyle->
isFavorite( entityType, name );
312 return symbol ? symbol->
type() : QVariant();
326 #ifndef _MSC_VER // avoid warning 333 if ( index.row() < 0 || index.row() >=
rowCount( QModelIndex() ) || role != Qt::EditRole )
336 switch ( index.column() )
342 switch ( entityType )
345 name = mSymbolNames.value( index.row() );
349 name = mRampNames.value( index.row() - mSymbolNames.size() );
353 name = mTextFormatNames.value( index.row() - mSymbolNames.size() - mRampNames.size() );
357 name = mLabelSettingsNames.value( index.row() - mSymbolNames.size() - mRampNames.size() - mTextFormatNames.size() );
365 const QString newName = value.toString();
367 switch ( entityType )
397 Qt::ItemFlags
flags = QAbstractItemModel::flags( index );
398 if ( index.isValid() && index.column() ==
Name )
400 return flags | Qt::ItemIsEditable;
410 if ( role == Qt::DisplayRole )
412 if ( orientation == Qt::Vertical )
414 return QVariant( section );
421 return QVariant( tr(
"Name" ) );
424 return QVariant( tr(
"Tags" ) );
439 if ( !hasIndex( row, column, parent ) )
440 return QModelIndex();
442 if ( !parent.isValid() )
444 return createIndex( row, column );
447 return QModelIndex();
453 return QModelIndex();
458 if ( !parent.isValid() )
460 return mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() + mLabelSettingsNames.count();
472 if ( mAdditionalSizes.contains( size ) )
475 mAdditionalSizes << size;
476 mSymbolIconCache.clear();
477 mColorRampIconCache.clear();
478 mTextFormatIconCache.clear();
479 mLabelSettingsIconCache.clear();
482 void QgsStyleModel::onSymbolAdded(
const QString &name,
QgsSymbol * )
484 mSymbolIconCache.remove( name );
485 const QStringList oldSymbolNames = mSymbolNames;
486 const QStringList newSymbolNames = mStyle->
symbolNames();
489 const int newNameIndex = newSymbolNames.indexOf( name );
490 if ( newNameIndex < 0 )
493 beginInsertRows( QModelIndex(), newNameIndex, newNameIndex );
494 mSymbolNames = newSymbolNames;
498 void QgsStyleModel::onSymbolRemoved(
const QString &name )
500 mSymbolIconCache.remove( name );
501 const QStringList oldSymbolNames = mSymbolNames;
502 const QStringList newSymbolNames = mStyle->
symbolNames();
505 const int oldNameIndex = oldSymbolNames.indexOf( name );
506 if ( oldNameIndex < 0 )
509 beginRemoveRows( QModelIndex(), oldNameIndex, oldNameIndex );
510 mSymbolNames = newSymbolNames;
514 void QgsStyleModel::onSymbolChanged(
const QString &name )
516 mSymbolIconCache.remove( name );
518 QModelIndex i =
index( mSymbolNames.indexOf( name ),
Tags );
519 emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
522 void QgsStyleModel::onSymbolRename(
const QString &oldName,
const QString &newName )
524 mSymbolIconCache.remove( oldName );
525 const QStringList oldSymbolNames = mSymbolNames;
526 const QStringList newSymbolNames = mStyle->
symbolNames();
529 const int oldNameIndex = oldSymbolNames.indexOf( oldName );
530 if ( oldNameIndex < 0 )
534 const int newNameIndex = newSymbolNames.indexOf( newName );
535 if ( newNameIndex < 0 )
538 if ( newNameIndex == oldNameIndex )
540 mSymbolNames = newSymbolNames;
544 beginMoveRows( QModelIndex(), oldNameIndex, oldNameIndex, QModelIndex(), newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex );
545 mSymbolNames = newSymbolNames;
549 void QgsStyleModel::onRampAdded(
const QString &name )
551 mColorRampIconCache.remove( name );
552 const QStringList oldRampNames = mRampNames;
556 const int newNameIndex = newRampNames.indexOf( name );
557 if ( newNameIndex < 0 )
560 beginInsertRows( QModelIndex(), newNameIndex + mSymbolNames.count(), newNameIndex + mSymbolNames.count() );
561 mRampNames = newRampNames;
565 void QgsStyleModel::onRampRemoved(
const QString &name )
567 mColorRampIconCache.remove( name );
568 const QStringList oldRampNames = mRampNames;
572 const int oldNameIndex = oldRampNames.indexOf( name );
573 if ( oldNameIndex < 0 )
576 beginRemoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count(), oldNameIndex + mSymbolNames.count() );
577 mRampNames = newRampNames;
581 void QgsStyleModel::onRampChanged(
const QString &name )
583 mColorRampIconCache.remove( name );
585 QModelIndex i =
index( mSymbolNames.count() + mRampNames.indexOf( name ),
Tags );
586 emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
589 void QgsStyleModel::onRampRename(
const QString &oldName,
const QString &newName )
591 mColorRampIconCache.remove( oldName );
592 const QStringList oldRampNames = mRampNames;
596 const int oldNameIndex = oldRampNames.indexOf( oldName );
597 if ( oldNameIndex < 0 )
601 const int newNameIndex = newRampNames.indexOf( newName );
602 if ( newNameIndex < 0 )
605 if ( newNameIndex == oldNameIndex )
607 mRampNames = newRampNames;
611 beginMoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count(), oldNameIndex + mSymbolNames.count(),
612 QModelIndex(), ( newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex ) + mSymbolNames.count() );
613 mRampNames = newRampNames;
617 void QgsStyleModel::onTextFormatAdded(
const QString &name )
619 mTextFormatIconCache.remove( name );
620 const QStringList oldTextFormatNames = mTextFormatNames;
624 const int newNameIndex = newTextFormatNames.indexOf( name );
625 if ( newNameIndex < 0 )
628 beginInsertRows( QModelIndex(), newNameIndex + mSymbolNames.count() + mRampNames.count(), newNameIndex + mSymbolNames.count() + mRampNames.count() );
629 mTextFormatNames = newTextFormatNames;
633 void QgsStyleModel::onTextFormatRemoved(
const QString &name )
635 mTextFormatIconCache.remove( name );
636 const QStringList oldTextFormatNames = mTextFormatNames;
640 const int oldNameIndex = oldTextFormatNames.indexOf( name );
641 if ( oldNameIndex < 0 )
644 beginRemoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count() + mRampNames.count(), oldNameIndex + mSymbolNames.count() + mRampNames.count() );
645 mTextFormatNames = newTextFormatNames;
649 void QgsStyleModel::onTextFormatChanged(
const QString &name )
651 mTextFormatIconCache.remove( name );
653 QModelIndex i =
index( mSymbolNames.count() + mRampNames.count() + mTextFormatNames.indexOf( name ),
Tags );
654 emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
657 void QgsStyleModel::onTextFormatRename(
const QString &oldName,
const QString &newName )
659 mTextFormatIconCache.remove( oldName );
660 const QStringList oldTextFormatNames = mTextFormatNames;
664 const int oldNameIndex = oldTextFormatNames.indexOf( oldName );
665 if ( oldNameIndex < 0 )
669 const int newNameIndex = newTextFormatNames.indexOf( newName );
670 if ( newNameIndex < 0 )
673 if ( newNameIndex == oldNameIndex )
675 mTextFormatNames = newTextFormatNames;
679 beginMoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count() + mRampNames.count(), oldNameIndex + mSymbolNames.count() + mRampNames.count(),
680 QModelIndex(), ( newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex ) + mSymbolNames.count() + mRampNames.count() );
681 mTextFormatNames = newTextFormatNames;
685 void QgsStyleModel::onLabelSettingsAdded(
const QString &name )
687 mLabelSettingsIconCache.remove( name );
688 const QStringList oldLabelSettingsNames = mLabelSettingsNames;
692 const int newNameIndex = newLabelSettingsNames.indexOf( name );
693 if ( newNameIndex < 0 )
696 beginInsertRows( QModelIndex(), newNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count(), newNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() );
697 mLabelSettingsNames = newLabelSettingsNames;
701 void QgsStyleModel::onLabelSettingsRemoved(
const QString &name )
703 mLabelSettingsIconCache.remove( name );
704 const QStringList oldLabelSettingsNames = mLabelSettingsNames;
708 const int oldNameIndex = oldLabelSettingsNames.indexOf( name );
709 if ( oldNameIndex < 0 )
712 beginRemoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count(), oldNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() );
713 mLabelSettingsNames = newLabelSettingsNames;
717 void QgsStyleModel::onLabelSettingsChanged(
const QString &name )
719 mLabelSettingsIconCache.remove( name );
721 QModelIndex i =
index( mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() + mLabelSettingsNames.indexOf( name ),
Tags );
722 emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
725 void QgsStyleModel::onLabelSettingsRename(
const QString &oldName,
const QString &newName )
727 mLabelSettingsIconCache.remove( oldName );
728 const QStringList oldLabelSettingsNames = mLabelSettingsNames;
732 const int oldNameIndex = oldLabelSettingsNames.indexOf( oldName );
733 if ( oldNameIndex < 0 )
737 const int newNameIndex = newLabelSettingsNames.indexOf( newName );
738 if ( newNameIndex < 0 )
741 if ( newNameIndex == oldNameIndex )
743 mLabelSettingsNames = newLabelSettingsNames;
747 beginMoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count(), oldNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count(),
748 QModelIndex(), ( newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex ) + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() );
749 mLabelSettingsNames = newLabelSettingsNames;
753 void QgsStyleModel::onTagsChanged(
int entity,
const QString &name,
const QStringList & )
756 switch ( static_cast< QgsStyle::StyleEntity >( entity ) )
759 i =
index( mSymbolNames.indexOf( name ),
Tags );
763 i =
index( mSymbolNames.count() + mRampNames.indexOf( name ),
Tags );
767 i =
index( mSymbolNames.count() + mRampNames.count() + mTextFormatNames.indexOf( name ),
Tags );
771 i =
index( mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() + mLabelSettingsNames.indexOf( name ),
Tags );
778 emit dataChanged( i, i );
781 void QgsStyleModel::rebuildSymbolIcons()
783 mSymbolIconCache.clear();
784 mExpressionContext.reset();
785 emit dataChanged(
index( 0, 0 ),
index( mSymbolNames.count() - 1, 0 ), QVector<int>() << Qt::DecorationRole );
804 : QSortFilterProxyModel( parent )
811 void QgsStyleProxyModel::initialize()
813 setSortCaseSensitivity( Qt::CaseInsensitive );
815 setSourceModel( mModel );
816 setDynamicSortFilter(
true );
824 if ( mSmartGroupId >= 0 )
831 if ( mFavoritesOnly )
837 if ( mSmartGroupId >= 0 )
842 if ( mSmartGroupId >= 0 )
847 if ( mSmartGroupId >= 0 )
852 if ( mSmartGroupId >= 0 )
858 : QSortFilterProxyModel( parent )
860 , mStyle( model->style() )
867 if ( mFilterString.isEmpty() && !mEntityFilterEnabled && !mSymbolTypeFilterEnabled && mTagId < 0 && mSmartGroupId < 0 && !mFavoritesOnly )
870 QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
871 const QString name = sourceModel()->data( index ).toString();
875 if ( mEntityFilterEnabled && ( mEntityFilters.empty() || !mEntityFilters.contains( styleEntityType ) ) )
879 if ( mSymbolTypeFilterEnabled && symbolType != mSymbolType )
886 if ( mTagId >= 0 && !mTaggedSymbolNames.contains( name ) )
889 if ( mSmartGroupId >= 0 && !mSmartGroupSymbolNames.contains( name ) )
895 if ( !mFilterString.isEmpty() )
899 const QStringList partsToMatch = mFilterString.trimmed().split(
' ' );
901 QStringList partsToSearch = name.split(
' ' );
902 for (
const QString &tag : tags )
904 partsToSearch.append( tag.split(
' ' ) );
907 for (
const QString &part : partsToMatch )
910 for (
const QString &partToSearch : qgis::as_const( partsToSearch ) )
912 if ( partToSearch.contains( part, Qt::CaseInsensitive ) )
928 mFilterString = filter;
935 return mFavoritesOnly;
951 return mSymbolTypeFilterEnabled;
984 mTaggedSymbolNames.clear();
999 if ( mSmartGroupId >= 0 )
1008 mSmartGroupSymbolNames.clear();
1016 return mSmartGroupId;
1032 return mEntityFilterEnabled;
1048 mEntityFilters = QList< QgsStyle::StyleEntity >() << entityFilter;
1054 mEntityFilters = filters;
A QAbstractItemModel subclass for showing symbol and color ramp entities contained within a QgsStyle ...
static QgsSvgCache * svgCache()
Returns the application's SVG cache, used for caching SVG images and handling parameter replacement w...
int rowCount(const QModelIndex &parent=QModelIndex()) const override
QgsStyle * style()
Returns the style managed by the model.
void setFilterString(const QString &filter)
Sets a filter string, such that only symbol entities with names matching the specified string will be...
void symbolSaved(const QString &name, QgsSymbol *symbol)
Emitted every time a new symbol has been added to the database.
void textFormatAdded(const QString &name)
Emitted whenever a text format has been added to the style and the database has been updated as a res...
void setSmartGroupId(int id)
Sets a smart group id to filter style entities by.
Abstract base class for all rendered symbols.
static const double UI_SCALE_FACTOR
UI scaling factor.
QStringList symbolsWithTag(StyleEntity type, int tagid) const
Returns the symbol names with which have the given tag.
void entityTagsChanged(QgsStyle::StyleEntity entity, const QString &name, const QStringList &newTags)
Emitted whenever an entity's tags are changed.
QgsStyleModel(QgsStyle *style, QObject *parent=nullptr)
Constructor for QgsStyleModel, for the specified style and parent object.
static QgsImageCache * imageCache()
Returns the application's image cache, used for caching resampled versions of raster images...
void setTagId(int id)
Sets a tag id to filter style entities by.
QStringList tagsOfSymbol(StyleEntity type, const QString &symbol)
Returns the tags associated with the symbol.
Layer type (for label settings entities)
int columnCount(const QModelIndex &parent=QModelIndex()) const override
void setSymbolType(QgsSymbol::SymbolType type)
Sets the symbol type filter.
void projectColorsChanged()
Emitted whenever the project's color scheme has been changed.
static QPixmap labelSettingsPreviewPixmap(const QgsPalLayerSettings &settings, QSize size, const QString &previewText=QString(), int padding=0)
Returns a pixmap preview for label settings.
void textFormatRemoved(const QString &name)
Emitted whenever a text format has been removed from the style and the database has been updated as a...
void rampChanged(const QString &name)
Emitted whenever a color ramp's definition is changed.
QgsColorRamp * colorRamp(const QString &name) const
Returns a new copy of the specified color ramp.
QgsWkbTypes::GeometryType layerType() const
Returns the layer type filter, or QgsWkbTypes::UnknownGeometry if no layer type filter is present...
void setFavoritesOnly(bool favoritesOnly)
Sets whether the model should show only favorited entities.
void rampAdded(const QString &name)
Emitted whenever a color ramp has been added to the style and the database has been updated as a resu...
bool filterAcceptsRow(int source_row, const QModelIndex &source_parent) const override
int tagId() const
Returns the tag id used to filter style entities by.
QModelIndex parent(const QModelIndex &index) const override
StyleEntity
Enum for Entities involved in a style.
bool isFavorite(StyleEntity type, const QString &name)
Returns true if the symbol with matching type and name is marked as a favorite.
void setSymbolTypeFilterEnabled(bool enabled)
Sets whether filtering by symbol type is enabled.
SymbolType
Type of the symbol.
int symbolCount()
Returns count of symbols in style.
void setEntityFilterEnabled(bool enabled)
Sets whether filtering by entity type is enabled.
bool renameSymbol(const QString &oldName, const QString &newName)
Renames a symbol from oldName to newName.
QStringList textFormatNames() const
Returns a list of names of text formats in the style.
const double ICON_PADDING_FACTOR
QgsPalLayerSettings labelSettings(const QString &name) const
Returns the label settings with the specified name.
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
void rampRemoved(const QString &name)
Emitted whenever a color ramp has been removed from the style and the database has been updated as a ...
bool setData(const QModelIndex &index, const QVariant &value, int role=Qt::EditRole) override
void labelSettingsRemoved(const QString &name)
Emitted whenever label settings have been removed from the style and the database has been updated as...
const QgsSymbol * symbolRef(const QString &name) const
Returns a const pointer to a symbol (doesn't create new instance)
QStringList labelSettingsNames() const
Returns a list of names of label settings in the style.
static QPixmap textFormatPreviewPixmap(const QgsTextFormat &format, QSize size, const QString &previewText=QString(), int padding=0)
Returns a pixmap preview for a text format.
QModelIndex index(int row, int column, const QModelIndex &parent=QModelIndex()) const override
bool favoritesOnly() const
Returns true if the model is showing only favorited entities.
static QList< QgsExpressionContextScope * > globalProjectLayerScopes(const QgsMapLayer *layer)
Creates a list of three scopes: global, layer's project and layer.
void symbolRenamed(const QString &oldName, const QString &newName)
Emitted whenever a symbol has been renamed from oldName to newName.
void labelSettingsChanged(const QString &name)
Emitted whenever a label setting's definition is changed.
QgsTextFormat textFormat(const QString &name) const
Returns the text format with the specified name.
void textFormatRenamed(const QString &oldName, const QString &newName)
Emitted whenever a text format has been renamed from oldName to newName.
void setLayerType(QgsWkbTypes::GeometryType type)
Sets the layer type filter.
void favoritedChanged(QgsStyle::StyleEntity entity, const QString &name, bool isFavorite)
Emitted whenever an entity is either favorited or un-favorited.
static QPixmap colorRampPreviewPixmap(QgsColorRamp *ramp, QSize size, int padding=0)
Returns a pixmap preview for a color ramp.
void symbolRemoved(const QString &name)
Emitted whenever a symbol has been removed from the style and the database has been updated as a resu...
QStringList symbolsOfSmartgroup(StyleEntity type, int id)
Returns the symbols for the smartgroup.
QVariant headerData(int section, Qt::Orientation orientation, int role=Qt::DisplayRole) const override
void remoteImageFetched(const QString &url)
Emitted when the cache has finished retrieving an image file from a remote url.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
void addDesiredIconSize(QSize size)
Adds an additional icon size to generate for Qt::DecorationRole data.
void rampRenamed(const QString &oldName, const QString &newName)
Emitted whenever a color ramp has been renamed from oldName to newName.
QgsStyleProxyModel(QgsStyle *style, QObject *parent=nullptr)
Constructor for QgsStyleProxyModel, for the specified style and parent object.
void textFormatChanged(const QString &name)
Emitted whenever a text format's definition is changed.
int smartGroupId() const
Returns the smart group id used to filter style entities by.
void symbolChanged(const QString &name)
Emitted whenever a symbol's definition is changed.
SymbolType type() const
Returns the symbol's type.
QgsSymbol::SymbolType symbolType() const
Returns the symbol type filter.
bool entityFilterEnabled() const
Returns true if filtering by entity type is enabled.
static QPixmap symbolPreviewPixmap(const QgsSymbol *symbol, QSize size, int padding=0, QgsRenderContext *customContext=nullptr, bool selected=false, const QgsExpressionContext *expressionContext=nullptr)
Returns a pixmap preview for a color ramp.
static QgsProject * instance()
Returns the QgsProject singleton instance.
QStringList colorRampNames() const
Returns a list of names of color ramps.
bool renameLabelSettings(const QString &oldName, const QString &newName)
Changes a label setting's name.
bool renameColorRamp(const QString &oldName, const QString &newName)
Changes ramp's name.
QgsWkbTypes::GeometryType labelSettingsLayerType(const QString &name) const
Returns the layer geometry type corresponding to the label settings with the specified name...
int colorRampCount()
Returns count of color ramps.
void labelSettingsRenamed(const QString &oldName, const QString &newName)
Emitted whenever label settings have been renamed from oldName to newName.
void remoteSvgFetched(const QString &url)
Emitted when the cache has finished retrieving an SVG file from a remote url.
void labelSettingsAdded(const QString &name)
Emitted whenever label settings have been added to the style and the database has been updated as a r...
QgsSymbol * symbol(const QString &name)
Returns a NEW copy of symbol.
QVariant data(const QModelIndex &index, int role) const override
Whether entity is flagged as a favorite.
void setEntityFilter(QgsStyle::StyleEntity filter)
Sets the style entity type filter.
Container for all settings relating to text rendering.
Style entity type, see QgsStyle::StyleEntity.
QgsStyle::StyleEntity entityFilter() const
Returns the style entity type filter.
bool symbolTypeFilterEnabled() const
Returns true if filtering by symbol type is enabled.
bool renameTextFormat(const QString &oldName, const QString &newName)
Changes a text format's name.
void setEntityFilters(const QList< QgsStyle::StyleEntity > &filters)
Sets the style entity type filters.
Qt::ItemFlags flags(const QModelIndex &index) const override
Symbol type (for symbol entities)
QStringList symbolNames() const
Returns a list of names of symbols.