61#define QGSCLIPBOARD_STYLE_MIME "application/qgis.style"
62#define QGSCLIPBOARD_STYLES_MIME "application/qgis.styles"
107 Q_ENUM( SymbolTableColumn )
119 Q_ENUM( TagTableColumn )
131 Q_ENUM( TagmapTableColumn )
145 Q_ENUM( ColorRampTableColumn )
159 Q_ENUM( TextFormatTableColumn )
173 Q_ENUM( LabelSettingsTableColumn )
186 Q_ENUM( SmartGroupTableColumn )
224 QString name()
const;
232 void setName(
const QString &name );
254 bool isReadOnly()
const;
265 void setReadOnly(
bool readOnly );
311 bool addTextFormat(
const QString &name,
const QgsTextFormat &format,
bool update =
false );
323 bool addLabelSettings(
const QString &name,
const QgsPalLayerSettings &settings,
bool update =
false );
335 bool addLegendPatchShape(
const QString &name,
const QgsLegendPatchShape &shape,
bool update =
false );
369 int addTag(
const QString &tagName );
394 int addSmartgroup(
const QString &name,
const QString &op,
const QStringList &matchTag,
const QStringList &noMatchTag,
const QStringList &matchName,
const QStringList &noMatchName );
401 QStringList tags()
const;
413 int colorRampCount();
416 QStringList colorRampNames()
const;
419 const QgsColorRamp *colorRampRef(
const QString &name )
const;
425 int colorrampId(
const QString &name );
438 int textFormatCount()
const;
444 QStringList textFormatNames()
const;
452 int textFormatId(
const QString &name );
472 int legendPatchShapesCount()
const;
494 int symbol3DCount()
const;
502 QList< Qgis::GeometryType > symbol3DCompatibleGeometryTypes(
const QString &name )
const;
517 int labelSettingsCount()
const;
523 QStringList labelSettingsNames()
const;
531 int labelSettingsId(
const QString &name );
541 static QgsStyle *defaultStyle(
bool initialize =
true );
544 static void cleanDefaultStyle()
SIP_SKIP;
555 bool tagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
566 bool detagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
576 bool detagSymbol( StyleEntity type, const QString &symbol );
579 bool removeSymbol( const QString &name );
588 bool renameEntity( StyleEntity type, const QString &oldName, const QString &newName );
595 bool renameSymbol( const QString &oldName, const QString &newName );
601 const
QgsSymbol *symbolRef( const QString &name ) const;
607 QStringList symbolNames() const;
613 int symbolId( const QString &name );
619 int entityId( StyleEntity type, const QString &name );
622 int tagId( const QString &tag );
624 int smartgroupId( const QString &smartgroup );
630 QStringList allNames( StyleEntity type ) const;
638 QStringList symbolsOfFavorite( StyleEntity type ) const;
647 QStringList symbolsWithTag( StyleEntity type,
int tagid ) const;
656 bool addFavorite( StyleEntity type, const QString &name );
665 bool removeFavorite( StyleEntity type, const QString &name );
674 bool rename( StyleEntity type,
int id, const QString &newName );
684 bool remove( StyleEntity type,
int id );
692 bool removeEntityByName( StyleEntity type, const QString &name );
703 bool saveSymbol( const QString &name, const
QgsSymbol *symbol,
bool favorite, const QStringList &tags );
714 bool saveColorRamp( const QString &name, const
QgsColorRamp *ramp,
bool favorite, const QStringList &tags );
717 bool removeColorRamp( const QString &name );
720 bool renameColorRamp( const QString &oldName, const QString &newName );
731 bool saveTextFormat( const QString &name, const
QgsTextFormat &format,
bool favorite, const QStringList &tags );
737 bool removeTextFormat( const QString &name );
744 bool renameTextFormat( const QString &oldName, const QString &newName );
755 bool saveLabelSettings( const QString &name, const
QgsPalLayerSettings &settings,
bool favorite, const QStringList &tags );
761 bool removeLabelSettings( const QString &name );
768 bool renameLabelSettings( const QString &oldName, const QString &newName );
781 bool saveLegendPatchShape( const QString &name, const
QgsLegendPatchShape &shape,
bool favorite, const QStringList &tags );
788 bool renameLegendPatchShape( const QString &oldName, const QString &newName );
794 QStringList legendPatchShapeNames() const;
819 QList< QList< QPolygonF > > defaultPatchAsQPolygonF(
Qgis::SymbolType type, QSizeF size ) const;
863 bool renameSymbol3D(
const QString &oldName,
const QString &newName );
869 QStringList symbol3DNames()
const;
889 bool renameMaterialSettings(
const QString &oldName,
const QString &newName );
895 QStringList materialSettingsNames()
const;
901 int materialSettingsCount()
const;
908 std::unique_ptr< QgsAbstractMaterialSettings > materialSettings(
const QString &name )
const;
917 bool createDatabase(
const QString &filename );
926 bool createMemoryDatabase();
947 bool load(
const QString &filename );
963 Q_DECL_DEPRECATED
bool save(
const QString &filename = QString() )
SIP_DEPRECATED;
994 void setFileName(
const QString &filename );
1003 QStringList findSymbols( StyleEntity type,
const QString &qword );
1012 QStringList tagsOfSymbol( StyleEntity type,
const QString &symbol );
1020 bool isFavorite( StyleEntity type,
const QString &name );
1030 bool symbolHasTag( StyleEntity type,
const QString &symbol,
const QString &tag );
1033 QString tag(
int id )
const;
1039 QStringList smartgroupNames()
const;
1047 QString smartgroupOperator(
int id );
1050 QStringList symbolsOfSmartgroup( StyleEntity type,
int id );
1053 bool exportXml(
const QString &filename );
1056 bool importXml(
const QString &filename );
1066 static bool isXmlStyleFile(
const QString &path );
1078 void triggerIconRebuild();
1299 bool mInitialized =
true;
1301 bool mReadOnly =
false;
1307 QMap<QString, QgsLegendPatchShape > mLegendPatchShapes;
1308 QMap<QString, QgsAbstract3DSymbol * > m3dSymbols;
1309 QMap<QString, QgsAbstractMaterialSettings * > mMaterialSettings;
1311 QHash< QgsStyle::StyleEntity, QHash< QString, QStringList > > mCachedTags;
1312 QHash< QgsStyle::StyleEntity, QHash< QString, bool > > mCachedFavorites;
1314 QString mErrorString;
1319 std::unique_ptr< QgsSymbol > mPatchMarkerSymbol;
1320 std::unique_ptr< QgsSymbol > mPatchLineSymbol;
1321 std::unique_ptr< QgsSymbol > mPatchFillSymbol;
1323 mutable QHash< int, QHash< QSizeF, QgsLegendPatchShape > > mDefaultPatchCache;
1324 mutable QHash< int, QHash< QSizeF, QList< QList< QPolygonF > > > > mDefaultPatchQPolygonFCache;
1326 QMap< QString, QDomElement > mDeferred3DsymbolElements;
1327 void handleDeferred3DSymbolCreation();
1336 void initializeDefaultStyle(
const QString &filename );
1339 bool openDatabase(
const QString &filename );
1342 bool importXml(
const QString &filename,
int sinceVersion );
1350 bool runEmptyQuery(
const QString &query );
1353 int getId(
const QString &table,
const QString &
name );
1356 QString getName(
const QString &table,
int id )
const;
1373 bool createStyleMetadataTableIfNeeded();
1374 void upgradeIfRequired();
1379 static QString entityTableName(
StyleEntity type );
1384 static QString tagmapTableName(
StyleEntity type );
1389 static QString tagmapEntityIdFieldName(
StyleEntity type );
1407 switch ( sipCpp->type() )
1410 sipType = sipType_QgsStyleSymbolEntity;
1414 sipType = sipType_QgsStyleColorRampEntity;
1418 sipType = sipType_QgsStyleTextFormatEntity;
1422 sipType = sipType_QgsStyleLabelSettingsEntity;
1426 sipType = sipType_QgsStyleLegendPatchShapeEntity;
1430 sipType = sipType_QgsStyleSymbol3DEntity;
1434 sipType = sipType_QgsStyleMaterialSettingsEntity;
Provides global constants and enumerations for use throughout the application.
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
Abstract base class for material settings.
Abstract base class for color ramps.
Represents a patch shape for use in map legends.
Contains settings for how a map layer will be labeled.
Encapsulates a QGIS project, including sets of map layers and their styles, layouts,...
QgsStyleColorRampEntity(QgsColorRamp *ramp)
Constructor for QgsStyleColorRampEntity, with the specified color ramp.
QgsColorRamp * ramp() const
Returns the entity's color ramp.
An interface for entities which can be placed in a QgsStyle database.
virtual QgsStyle::StyleEntity type() const =0
Returns the type of style entity.
virtual ~QgsStyleEntityInterface()=default
const QgsPalLayerSettings & settings() const
Returns the entity's label settings.
QgsStyleLabelSettingsEntity(const QgsPalLayerSettings &settings)
Constructor for QgsStyleLabelSettingsEntity, with the specified label settings.
const QgsLegendPatchShape & shape() const
Returns the entity's legend patch shape.
QgsStyleLegendPatchShapeEntity(const QgsLegendPatchShape &shape)
Constructor for QgsStyleLegendPatchShapeEntity, with the specified legend patch shape.
const QgsAbstractMaterialSettings * settings() const
Returns the entity's settings.
QgsStyleMaterialSettingsEntity(const QgsAbstractMaterialSettings *settings)
Constructor for QgsStyleMaterialSettingsEntity, with the specified settings.
const QgsAbstract3DSymbol * symbol() const
Returns the entity's symbol.
QgsStyleSymbol3DEntity(const QgsAbstract3DSymbol *symbol)
Constructor for QgsStyleSymbol3DEntity, with the specified symbol.
QgsStyleSymbolEntity(QgsSymbol *symbol)
Constructor for QgsStyleSymbolEntity, with the specified symbol.
QgsSymbol * symbol() const
Returns the entity's symbol.
QgsTextFormat format() const
Returns the entity's text format.
QgsStyleTextFormatEntity(const QgsTextFormat &format)
Constructor for QgsStyleTextFormatEntity, with the specified text format.
A database of saved style entities, including symbols, color ramps, text formats and others.
void labelSettingsChanged(const QString &name)
Emitted whenever a label setting's definition is changed.
QString errorString() const
Returns the last error from a load() operation.
void entityChanged(QgsStyle::StyleEntity entity, const QString &name)
Emitted whenever an entity's definition is changed.
void labelSettingsAdded(const QString &name)
Emitted whenever label settings have been added to the style and the database has been updated as a r...
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...
void rebuildIconPreviews()
Emitted whenever icon previews for entities in the style must be rebuilt.
void aboutToBeDestroyed()
Emitted just before the style object is destroyed.
LabelSettingsTableColumn
Columns available in the label settings table.
QgsSymbol * symbol(const QString &name)
Returns a NEW copy of symbol.
void labelSettingsRemoved(const QString &name)
Emitted whenever label settings have been removed from the style and the database has been updated as...
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 symbolRenamed(const QString &oldName, const QString &newName)
Emitted whenever a symbol has been renamed from oldName to newName.
ColorRampTableColumn
Columns available in the color ramp table.
void groupsModified()
Emitted every time a tag or smartgroup has been added, removed, or renamed.
void rampRemoved(const QString &name)
Emitted whenever a color ramp has been removed from the style and the database has been updated as a ...
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 textFormatChanged(const QString &name)
Emitted whenever a text format's definition is changed.
void symbolSaved(const QString &name, const QgsSymbol *symbol)
Emitted every time a new symbol has been added to the database.
void textFormatRenamed(const QString &oldName, const QString &newName)
Emitted whenever a text format has been renamed from oldName to newName.
void labelSettingsRenamed(const QString &oldName, const QString &newName)
Emitted whenever label settings have been renamed from oldName to newName.
void initialized()
Emitted when the style database has been fully initialized.
TextFormatTableColumn
Columns available in the text format table.
QString fileName() const
Returns the current file name of the style database.
void rampRenamed(const QString &oldName, const QString &newName)
Emitted whenever a color ramp has been renamed from oldName to newName.
bool isInitialized() const
Returns true if the style is initialized and ready for use.
SmartGroupTableColumn
Columns available in the smart group table.
TagTableColumn
Columns available in the Tags table.
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...
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.
QgsStyle(QObject *parent=nullptr)
Constructor for QgsStyle, with the specified parent object.
SymbolTableColumn
Columns available in the Symbols table.
TagmapTableColumn
Columns available in the tag to symbol table.
void rampChanged(const QString &name)
Emitted whenever a color ramp's definition is changed.
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.
TextFormatContext
Text format context.
@ Labeling
Text format used in labeling.
void symbolRemoved(const QString &name)
Emitted whenever a symbol has been removed from the style and the database has been updated as a resu...
void symbolChanged(const QString &name)
Emitted whenever a symbol's definition is changed.
void textFormatRemoved(const QString &name)
Emitted whenever a text format has been removed from the style and the database has been updated as a...
bool importXml(const QString &filename)
Imports the symbols and colorramps into the default style database from the given XML file.
Abstract base class for symbol layers.
Abstract base class for all rendered symbols.
Container for all settings relating to text rendering.
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...
QMultiMap< QString, QString > QgsSmartConditionMap
A multimap to hold the smart group conditions as constraint and parameter pairs.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
QMap< QString, QgsSymbol * > QgsSymbolMap
QMap< QString, QgsPalLayerSettings > QgsLabelSettingsMap
Map of name to label settings.
QMap< QString, QgsTextFormat > QgsTextFormatMap
Map of name to text format.
QMap< QString, QgsColorRamp * > QgsVectorColorRampMap
QMap< int, QString > QgsSymbolGroupMap