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 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) 131 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data( index, Qt::FontRole ).value< QFont >() ).width(
'X' ) * 23 );
133 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data( index, Qt::FontRole ).value< QFont >() ).horizontalAdvance(
'X' ) * 23 );
135 int height =
static_cast< int >( width / 1.61803398875 );
138 QBuffer buffer( &data );
139 pm.save( &buffer,
"PNG", 100 );
140 tooltip += QStringLiteral(
"<p><img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) );
147 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) 148 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data( index, Qt::FontRole ).value< QFont >() ).width(
'X' ) * 23 );
150 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data( index, Qt::FontRole ).value< QFont >() ).horizontalAdvance(
'X' ) * 23 );
152 int height =
static_cast< int >( width / 1.61803398875 );
156 QBuffer buffer( &data );
157 pm.save( &buffer,
"PNG", 100 );
158 tooltip += QStringLiteral(
"<p><img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) );
164 #if QT_VERSION < QT_VERSION_CHECK(5, 11, 0) 165 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data( index, Qt::FontRole ).value< QFont >() ).width(
'X' ) * 23 );
167 int width =
static_cast< int >(
Qgis::UI_SCALE_FACTOR * QFontMetrics(
data( index, Qt::FontRole ).value< QFont >() ).horizontalAdvance(
'X' ) * 23 );
169 int height =
static_cast< int >( width / 1.61803398875 );
173 QBuffer buffer( &data );
174 pm.save( &buffer,
"PNG", 100 );
175 tooltip += QStringLiteral(
"<p><img src='data:image/png;base64, %3'>" ).arg( QString( data.toBase64() ) );
192 return mStyle->
tagsOfSymbol( entityType, name ).join( QStringLiteral(
", " ) );
197 case Qt::DecorationRole:
202 if ( !mExpressionContext )
208 mExpressionContext = qgis::make_unique< QgsExpressionContext >();
212 switch ( index.column() )
215 switch ( entityType )
220 QIcon icon = mSymbolIconCache.value( name );
221 if ( !icon.isNull() )
224 std::unique_ptr< QgsSymbol > symbol( mStyle->
symbol( name ) );
227 if ( mAdditionalSizes.isEmpty() )
230 for (
const QSize &s : mAdditionalSizes )
236 mSymbolIconCache.insert( name, icon );
242 QIcon icon = mColorRampIconCache.value( name );
243 if ( !icon.isNull() )
246 std::unique_ptr< QgsColorRamp > ramp( mStyle->
colorRamp( name ) );
249 if ( mAdditionalSizes.isEmpty() )
251 for (
const QSize &s : mAdditionalSizes )
257 mColorRampIconCache.insert( name, icon );
264 QIcon icon = mTextFormatIconCache.value( name );
265 if ( !icon.isNull() )
269 if ( mAdditionalSizes.isEmpty() )
271 for (
const QSize &s : mAdditionalSizes )
275 mTextFormatIconCache.insert( name, icon );
282 QIcon icon = mLabelSettingsIconCache.value( name );
283 if ( !icon.isNull() )
287 if ( mAdditionalSizes.isEmpty() )
289 for (
const QSize &s : mAdditionalSizes )
293 mLabelSettingsIconCache.insert( name, icon );
316 return mStyle->
isFavorite( entityType, name );
324 return symbol ? symbol->
type() : QVariant();
338 #ifndef _MSC_VER // avoid warning 345 if ( index.row() < 0 || index.row() >=
rowCount( QModelIndex() ) || role != Qt::EditRole )
348 switch ( index.column() )
354 switch ( entityType )
357 name = mSymbolNames.value( index.row() );
361 name = mRampNames.value( index.row() - mSymbolNames.size() );
365 name = mTextFormatNames.value( index.row() - mSymbolNames.size() - mRampNames.size() );
369 name = mLabelSettingsNames.value( index.row() - mSymbolNames.size() - mRampNames.size() - mTextFormatNames.size() );
377 const QString newName = value.toString();
379 switch ( entityType )
409 Qt::ItemFlags
flags = QAbstractItemModel::flags( index );
410 if ( index.isValid() && index.column() ==
Name )
412 return flags | Qt::ItemIsEditable;
422 if ( role == Qt::DisplayRole )
424 if ( orientation == Qt::Vertical )
426 return QVariant( section );
433 return QVariant( tr(
"Name" ) );
436 return QVariant( tr(
"Tags" ) );
451 if ( !hasIndex( row, column, parent ) )
452 return QModelIndex();
454 if ( !parent.isValid() )
456 return createIndex( row, column );
459 return QModelIndex();
465 return QModelIndex();
470 if ( !parent.isValid() )
472 return mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() + mLabelSettingsNames.count();
484 if ( mAdditionalSizes.contains( size ) )
487 mAdditionalSizes << size;
488 mSymbolIconCache.clear();
489 mColorRampIconCache.clear();
490 mTextFormatIconCache.clear();
491 mLabelSettingsIconCache.clear();
494 void QgsStyleModel::onSymbolAdded(
const QString &name,
QgsSymbol * )
496 mSymbolIconCache.remove( name );
497 const QStringList oldSymbolNames = mSymbolNames;
498 const QStringList newSymbolNames = mStyle->
symbolNames();
501 const int newNameIndex = newSymbolNames.indexOf( name );
502 if ( newNameIndex < 0 )
505 beginInsertRows( QModelIndex(), newNameIndex, newNameIndex );
506 mSymbolNames = newSymbolNames;
510 void QgsStyleModel::onSymbolRemoved(
const QString &name )
512 mSymbolIconCache.remove( name );
513 const QStringList oldSymbolNames = mSymbolNames;
514 const QStringList newSymbolNames = mStyle->
symbolNames();
517 const int oldNameIndex = oldSymbolNames.indexOf( name );
518 if ( oldNameIndex < 0 )
521 beginRemoveRows( QModelIndex(), oldNameIndex, oldNameIndex );
522 mSymbolNames = newSymbolNames;
526 void QgsStyleModel::onSymbolChanged(
const QString &name )
528 mSymbolIconCache.remove( name );
530 QModelIndex i =
index( mSymbolNames.indexOf( name ),
Tags );
531 emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
534 void QgsStyleModel::onSymbolRename(
const QString &oldName,
const QString &newName )
536 mSymbolIconCache.remove( oldName );
537 const QStringList oldSymbolNames = mSymbolNames;
538 const QStringList newSymbolNames = mStyle->
symbolNames();
541 const int oldNameIndex = oldSymbolNames.indexOf( oldName );
542 if ( oldNameIndex < 0 )
546 const int newNameIndex = newSymbolNames.indexOf( newName );
547 if ( newNameIndex < 0 )
550 if ( newNameIndex == oldNameIndex )
552 mSymbolNames = newSymbolNames;
556 beginMoveRows( QModelIndex(), oldNameIndex, oldNameIndex, QModelIndex(), newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex );
557 mSymbolNames = newSymbolNames;
561 void QgsStyleModel::onRampAdded(
const QString &name )
563 mColorRampIconCache.remove( name );
564 const QStringList oldRampNames = mRampNames;
568 const int newNameIndex = newRampNames.indexOf( name );
569 if ( newNameIndex < 0 )
572 beginInsertRows( QModelIndex(), newNameIndex + mSymbolNames.count(), newNameIndex + mSymbolNames.count() );
573 mRampNames = newRampNames;
577 void QgsStyleModel::onRampRemoved(
const QString &name )
579 mColorRampIconCache.remove( name );
580 const QStringList oldRampNames = mRampNames;
584 const int oldNameIndex = oldRampNames.indexOf( name );
585 if ( oldNameIndex < 0 )
588 beginRemoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count(), oldNameIndex + mSymbolNames.count() );
589 mRampNames = newRampNames;
593 void QgsStyleModel::onRampChanged(
const QString &name )
595 mColorRampIconCache.remove( name );
597 QModelIndex i =
index( mSymbolNames.count() + mRampNames.indexOf( name ),
Tags );
598 emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
601 void QgsStyleModel::onRampRename(
const QString &oldName,
const QString &newName )
603 mColorRampIconCache.remove( oldName );
604 const QStringList oldRampNames = mRampNames;
608 const int oldNameIndex = oldRampNames.indexOf( oldName );
609 if ( oldNameIndex < 0 )
613 const int newNameIndex = newRampNames.indexOf( newName );
614 if ( newNameIndex < 0 )
617 if ( newNameIndex == oldNameIndex )
619 mRampNames = newRampNames;
623 beginMoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count(), oldNameIndex + mSymbolNames.count(),
624 QModelIndex(), ( newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex ) + mSymbolNames.count() );
625 mRampNames = newRampNames;
629 void QgsStyleModel::onTextFormatAdded(
const QString &name )
631 mTextFormatIconCache.remove( name );
632 const QStringList oldTextFormatNames = mTextFormatNames;
636 const int newNameIndex = newTextFormatNames.indexOf( name );
637 if ( newNameIndex < 0 )
640 beginInsertRows( QModelIndex(), newNameIndex + mSymbolNames.count() + mRampNames.count(), newNameIndex + mSymbolNames.count() + mRampNames.count() );
641 mTextFormatNames = newTextFormatNames;
645 void QgsStyleModel::onTextFormatRemoved(
const QString &name )
647 mTextFormatIconCache.remove( name );
648 const QStringList oldTextFormatNames = mTextFormatNames;
652 const int oldNameIndex = oldTextFormatNames.indexOf( name );
653 if ( oldNameIndex < 0 )
656 beginRemoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count() + mRampNames.count(), oldNameIndex + mSymbolNames.count() + mRampNames.count() );
657 mTextFormatNames = newTextFormatNames;
661 void QgsStyleModel::onTextFormatChanged(
const QString &name )
663 mTextFormatIconCache.remove( name );
665 QModelIndex i =
index( mSymbolNames.count() + mRampNames.count() + mTextFormatNames.indexOf( name ),
Tags );
666 emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
669 void QgsStyleModel::onTextFormatRename(
const QString &oldName,
const QString &newName )
671 mTextFormatIconCache.remove( oldName );
672 const QStringList oldTextFormatNames = mTextFormatNames;
676 const int oldNameIndex = oldTextFormatNames.indexOf( oldName );
677 if ( oldNameIndex < 0 )
681 const int newNameIndex = newTextFormatNames.indexOf( newName );
682 if ( newNameIndex < 0 )
685 if ( newNameIndex == oldNameIndex )
687 mTextFormatNames = newTextFormatNames;
691 beginMoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count() + mRampNames.count(), oldNameIndex + mSymbolNames.count() + mRampNames.count(),
692 QModelIndex(), ( newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex ) + mSymbolNames.count() + mRampNames.count() );
693 mTextFormatNames = newTextFormatNames;
697 void QgsStyleModel::onLabelSettingsAdded(
const QString &name )
699 mLabelSettingsIconCache.remove( name );
700 const QStringList oldLabelSettingsNames = mLabelSettingsNames;
704 const int newNameIndex = newLabelSettingsNames.indexOf( name );
705 if ( newNameIndex < 0 )
708 beginInsertRows( QModelIndex(), newNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count(), newNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() );
709 mLabelSettingsNames = newLabelSettingsNames;
713 void QgsStyleModel::onLabelSettingsRemoved(
const QString &name )
715 mLabelSettingsIconCache.remove( name );
716 const QStringList oldLabelSettingsNames = mLabelSettingsNames;
720 const int oldNameIndex = oldLabelSettingsNames.indexOf( name );
721 if ( oldNameIndex < 0 )
724 beginRemoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count(), oldNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() );
725 mLabelSettingsNames = newLabelSettingsNames;
729 void QgsStyleModel::onLabelSettingsChanged(
const QString &name )
731 mLabelSettingsIconCache.remove( name );
733 QModelIndex i =
index( mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() + mLabelSettingsNames.indexOf( name ),
Tags );
734 emit dataChanged( i, i, QVector< int >() << Qt::DecorationRole );
737 void QgsStyleModel::onLabelSettingsRename(
const QString &oldName,
const QString &newName )
739 mLabelSettingsIconCache.remove( oldName );
740 const QStringList oldLabelSettingsNames = mLabelSettingsNames;
744 const int oldNameIndex = oldLabelSettingsNames.indexOf( oldName );
745 if ( oldNameIndex < 0 )
749 const int newNameIndex = newLabelSettingsNames.indexOf( newName );
750 if ( newNameIndex < 0 )
753 if ( newNameIndex == oldNameIndex )
755 mLabelSettingsNames = newLabelSettingsNames;
759 beginMoveRows( QModelIndex(), oldNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count(), oldNameIndex + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count(),
760 QModelIndex(), ( newNameIndex > oldNameIndex ? newNameIndex + 1 : newNameIndex ) + mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() );
761 mLabelSettingsNames = newLabelSettingsNames;
765 void QgsStyleModel::onTagsChanged(
int entity,
const QString &name,
const QStringList & )
768 switch ( static_cast< QgsStyle::StyleEntity >( entity ) )
771 i =
index( mSymbolNames.indexOf( name ),
Tags );
775 i =
index( mSymbolNames.count() + mRampNames.indexOf( name ),
Tags );
779 i =
index( mSymbolNames.count() + mRampNames.count() + mTextFormatNames.indexOf( name ),
Tags );
783 i =
index( mSymbolNames.count() + mRampNames.count() + mTextFormatNames.count() + mLabelSettingsNames.indexOf( name ),
Tags );
790 emit dataChanged( i, i );
793 void QgsStyleModel::rebuildSymbolIcons()
795 mSymbolIconCache.clear();
796 mExpressionContext.reset();
797 emit dataChanged(
index( 0, 0 ),
index( mSymbolNames.count() - 1, 0 ), QVector<int>() << Qt::DecorationRole );
816 : QSortFilterProxyModel( parent )
823 void QgsStyleProxyModel::initialize()
825 setSortCaseSensitivity( Qt::CaseInsensitive );
827 setSourceModel( mModel );
828 setDynamicSortFilter(
true );
836 if ( mSmartGroupId >= 0 )
843 if ( mFavoritesOnly )
849 if ( mSmartGroupId >= 0 )
854 if ( mSmartGroupId >= 0 )
859 if ( mSmartGroupId >= 0 )
864 if ( mSmartGroupId >= 0 )
870 : QSortFilterProxyModel( parent )
872 , mStyle( model->style() )
879 if ( mFilterString.isEmpty() && !mEntityFilterEnabled && !mSymbolTypeFilterEnabled && mTagId < 0 && mSmartGroupId < 0 && !mFavoritesOnly )
882 QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
883 const QString name = sourceModel()->data( index ).toString();
887 if ( mEntityFilterEnabled && ( mEntityFilters.empty() || !mEntityFilters.contains( styleEntityType ) ) )
891 if ( mSymbolTypeFilterEnabled && symbolType != mSymbolType )
898 if ( mTagId >= 0 && !mTaggedSymbolNames.contains( name ) )
901 if ( mSmartGroupId >= 0 && !mSmartGroupSymbolNames.contains( name ) )
907 if ( !mFilterString.isEmpty() )
911 const QStringList partsToMatch = mFilterString.trimmed().split(
' ' );
913 QStringList partsToSearch = name.split(
' ' );
914 for (
const QString &tag : tags )
916 partsToSearch.append( tag.split(
' ' ) );
919 for (
const QString &part : partsToMatch )
922 for (
const QString &partToSearch : qgis::as_const( partsToSearch ) )
924 if ( partToSearch.contains( part, Qt::CaseInsensitive ) )
940 mFilterString = filter;
947 return mFavoritesOnly;
963 return mSymbolTypeFilterEnabled;
996 mTaggedSymbolNames.clear();
1011 if ( mSmartGroupId >= 0 )
1020 mSmartGroupSymbolNames.clear();
1028 return mSmartGroupId;
1044 return mEntityFilterEnabled;
1060 mEntityFilters = QList< QgsStyle::StyleEntity >() << entityFilter;
1066 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.