QGIS API Documentation
3.16.0-Hannover (43b64b13f3)
|
Go to the documentation of this file.
19 #include "qgis_core.h"
59 #define QGSCLIPBOARD_STYLE_MIME "application/qgis.style"
234 bool addTextFormat(
const QString &name,
const QgsTextFormat &format,
bool update =
false );
246 bool addLabelSettings(
const QString &name,
const QgsPalLayerSettings &settings,
bool update =
false );
258 bool addLegendPatchShape(
const QString &name,
const QgsLegendPatchShape &shape,
bool update =
false );
278 int addTag(
const QString &tagName );
303 int addSmartgroup(
const QString &name,
const QString &op,
const QStringList &matchTag,
const QStringList &noMatchTag,
304 const QStringList &matchName,
const QStringList &noMatchName );
312 QStringList tags()
const;
324 int colorRampCount();
327 QStringList colorRampNames()
const;
330 const QgsColorRamp *colorRampRef(
const QString &name )
const;
336 int colorrampId(
const QString &name );
349 int textFormatCount()
const;
355 QStringList textFormatNames()
const;
363 int textFormatId(
const QString &name );
383 int legendPatchShapesCount()
const;
405 int symbol3DCount()
const;
413 QList< QgsWkbTypes::GeometryType > symbol3DCompatibleGeometryTypes(
const QString &name )
const;
428 int labelSettingsCount()
const;
434 QStringList labelSettingsNames()
const;
442 int labelSettingsId(
const QString &name );
448 static void cleanDefaultStyle()
SIP_SKIP;
459 bool tagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
470 bool detagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
480 bool detagSymbol( StyleEntity type, const QString &symbol );
483 bool removeSymbol( const QString &name );
492 bool renameEntity( StyleEntity type, const QString &oldName, const QString &newName );
499 bool renameSymbol( const QString &oldName, const QString &newName );
505 const
QgsSymbol *symbolRef( const QString &name ) const;
511 QStringList symbolNames() const;
517 int symbolId( const QString &name );
523 int entityId( StyleEntity type, const QString &name );
526 int tagId( const QString &tag );
528 int smartgroupId( const QString &smartgroup );
534 QStringList allNames( StyleEntity type ) const;
542 QStringList symbolsOfFavorite( StyleEntity type ) const;
551 QStringList symbolsWithTag( StyleEntity type,
int tagid ) const;
560 bool addFavorite( StyleEntity type, const QString &name );
569 bool removeFavorite( StyleEntity type, const QString &name );
578 bool rename( StyleEntity type,
int id, const QString &newName );
588 bool remove( StyleEntity type,
int id );
596 bool removeEntityByName( StyleEntity type, const QString &name );
607 bool saveSymbol( const QString &name,
QgsSymbol *symbol,
bool favorite, const QStringList &tags );
618 bool saveColorRamp( const QString &name,
QgsColorRamp *ramp,
bool favorite, const QStringList &tags );
621 bool removeColorRamp( const QString &name );
624 bool renameColorRamp( const QString &oldName, const QString &newName );
635 bool saveTextFormat( const QString &name, const
QgsTextFormat &format,
bool favorite, const QStringList &tags );
641 bool removeTextFormat( const QString &name );
648 bool renameTextFormat( const QString &oldName, const QString &newName );
659 bool saveLabelSettings( const QString &name, const
QgsPalLayerSettings &settings,
bool favorite, const QStringList &tags );
665 bool removeLabelSettings( const QString &name );
672 bool renameLabelSettings( const QString &oldName, const QString &newName );
685 bool saveLegendPatchShape( const QString &name, const
QgsLegendPatchShape &shape,
bool favorite, const QStringList &tags );
692 bool renameLegendPatchShape( const QString &oldName, const QString &newName );
698 QStringList legendPatchShapeNames() const;
723 QList< QList< QPolygonF > > defaultPatchAsQPolygonF(
QgsSymbol::SymbolType type, QSizeF size ) const;
743 bool renameSymbol3D( const QString &oldName, const QString &newName );
749 QStringList symbol3DNames() const;
759 bool createDatabase( const QString &filename );
769 bool createMemoryDatabase();
789 bool load( const QString &filename );
792 bool save( QString filename = QString() );
795 QString errorString() {
return mErrorString; }
807 QStringList findSymbols( StyleEntity type,
const QString &qword );
816 QStringList tagsOfSymbol( StyleEntity type,
const QString &symbol );
824 bool isFavorite( StyleEntity type,
const QString &name );
834 bool symbolHasTag( StyleEntity type,
const QString &symbol,
const QString &tag );
837 QString tag(
int id )
const;
843 QStringList smartgroupNames()
const;
851 QString smartgroupOperator(
int id );
854 QStringList symbolsOfSmartgroup( StyleEntity type,
int id );
857 bool exportXml(
const QString &filename );
860 bool importXml(
const QString &filename );
870 static bool isXmlStyleFile(
const QString &path );
961 void rampRenamed(
const QString &oldName,
const QString &newName );
1068 QMap<QString, QgsLegendPatchShape > mLegendPatchShapes;
1069 QMap<QString, QgsAbstract3DSymbol * > m3dSymbols;
1071 QHash< QgsStyle::StyleEntity, QHash< QString, QStringList > > mCachedTags;
1072 QHash< QgsStyle::StyleEntity, QHash< QString, bool > > mCachedFavorites;
1074 QString mErrorString;
1079 std::unique_ptr< QgsSymbol > mPatchMarkerSymbol;
1080 std::unique_ptr< QgsSymbol > mPatchLineSymbol;
1081 std::unique_ptr< QgsSymbol > mPatchFillSymbol;
1083 mutable QHash< QgsSymbol::SymbolType, QHash< QSizeF, QgsLegendPatchShape > > mDefaultPatchCache;
1084 mutable QHash< QgsSymbol::SymbolType, QHash< QSizeF, QList< QList< QPolygonF > > > > mDefaultPatchQPolygonFCache;
1086 QMap< QString, QDomElement > mDeferred3DsymbolElements;
1087 void handleDeferred3DSymbolCreation();
1092 bool openDatabase(
const QString &filename );
1095 bool importXml(
const QString &filename,
int sinceVersion );
1103 bool runEmptyQuery(
const QString &query );
1106 int getId(
const QString &table,
const QString &name );
1109 QString getName(
const QString &table,
int id )
const;
1119 bool updateSymbol(
StyleEntity type,
const QString &name );
1121 void clearCachedTags(
StyleEntity type,
const QString &name );
1124 void upgradeIfRequired();
1129 static QString entityTableName(
StyleEntity type );
1134 static QString tagmapTableName(
StyleEntity type );
1139 static QString tagmapEntityIdFieldName(
StyleEntity type );
1157 switch ( sipCpp->type() )
1160 sipType = sipType_QgsStyleSymbolEntity;
1164 sipType = sipType_QgsStyleColorRampEntity;
1168 sipType = sipType_QgsStyleTextFormatEntity;
1172 sipType = sipType_QgsStyleLabelSettingsEntity;
1301 : mSettings( settings )
QString fileName()
Returns current file name of the style.
Abstract base class for color ramps.
void favoritedChanged(QgsStyle::StyleEntity entity, const QString &name, bool isFavorite)
Emitted whenever an entity is either favorited or un-favorited.
@ ColorrampXML
Color ramp definition (as XML)
QgsSymbol * symbol() const
Returns the entity's symbol.
@ ColorrampEntity
Color ramps.
void entityAdded(QgsStyle::StyleEntity entity, const QString &name)
Emitted every time a new entity has been added to the database.
QMap< QString, QgsTextFormat > QgsTextFormatMap
Map of name to text format.
@ ColorrampId
Color ramp ID.
A symbol entity for QgsStyle databases.
TextFormatTable
Columns available in the text format table.
QMap< QString, QgsSymbol * > QgsSymbolMap
A color ramp entity for QgsStyle databases.
const QgsLegendPatchShape & shape() const
Returns the entity's legend patch shape.
@ SmartgroupId
Smart group ID.
void labelSettingsChanged(const QString &name)
Emitted whenever a label setting's definition is changed.
virtual ~QgsStyleEntityInterface()=default
const QgsAbstract3DSymbol * symbol() const
Returns the entity's symbol.
An interface for entities which can be placed in a QgsStyle database.
QMap< QString, QgsColorRamp * > QgsVectorColorRampMap
void labelSettingsRemoved(const QString &name)
Emitted whenever label settings have been removed from the style and the database has been updated as...
QgsTextFormat format() const
Returns the entity's text format.
@ TextFormatXML
Text format definition (as XML)
Abstract base class for all rendered symbols.
@ LegendPatchShapeEntity
Legend patch shape (since QGIS 3.14)
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 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 textFormatRenamed(const QString &oldName, const QString &newName)
Emitted whenever a text format has been renamed from oldName to newName.
void symbolChanged(const QString &name)
Emitted whenever a symbol's definition is changed.
Represents a patch shape for use in map legends.
SymbolTable
Columns available in the Symbols table.
@ LabelSettingsId
Label settings ID.
@ SmartgroupXML
Smart group definition (as XML)
@ LabelSettingsEntity
Label settings.
@ TextFormatFavoriteId
Text format is favorite flag.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
@ ColorrampName
Color ramp name.
@ SymbolFavoriteId
Symbol is favorite flag.
Container for all settings relating to text rendering.
3 Abstract base class for 3D symbols that are used by VectorLayer3DRenderer objects.
QgsStyleLabelSettingsEntity(const QgsPalLayerSettings &settings)
Constructor for QgsStyleLabelSettingsEntity, with the specified label settings.
A 3d symbol entity for QgsStyle databases.
SmartgroupTable
Columns available in the smart group table.
@ Symbol3DEntity
3D symbol entity (since QGIS 3.14)
@ LabelSettingsName
Label settings name.
QgsStyleTextFormatEntity(const QgsTextFormat &format)
Constructor for QgsStyleTextFormatEntity, with the specified text format.
void entityTagsChanged(QgsStyle::StyleEntity entity, const QString &name, const QStringList &newTags)
Emitted whenever an entity's tags are changed.
void textFormatChanged(const QString &name)
Emitted whenever a text format's definition is changed.
virtual QgsStyle::StyleEntity type() const =0
Returns the type of style entity.
A text format entity for QgsStyle databases.
@ SmartgroupEntity
Smart groups.
QgsStyleSymbol3DEntity(const QgsAbstract3DSymbol *symbol)
Constructor for QgsStyleSymbol3DEntity, with the specified symbol.
void groupsModified()
Emitted every time a tag or smartgroup has been added, removed, or renamed.
QgsColorRamp * ramp() const
Returns the entity's color ramp.
void entityChanged(QgsStyle::StyleEntity entity, const QString &name)
Emitted whenever an entity's definition is changed.
@ ColorrampFavoriteId
Color ramp is favorite flag.
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...
A label settings entity for QgsStyle databases.
QgsStyleLegendPatchShapeEntity(const QgsLegendPatchShape &shape)
Constructor for QgsStyleLegendPatchShapeEntity, with the specified legend patch shape.
LabelSettingsTable
Columns available in the label settings table.
QgsStyleSymbolEntity(QgsSymbol *symbol)
Constructor for QgsStyleSymbolEntity, with the specified symbol.
void rampRenamed(const QString &oldName, const QString &newName)
Emitted whenever a color ramp has been renamed from oldName to newName.
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
@ TextFormatEntity
Text formats.
@ TextFormatName
Text format name.
QMap< QString, QgsPalLayerSettings > QgsLabelSettingsMap
Map of name to label settings.
QMap< int, QString > QgsSymbolGroupMap
void symbolSaved(const QString &name, QgsSymbol *symbol)
Emitted every time a new symbol has been added to the database.
@ SymbolXML
Symbol definition (as XML)
void labelSettingsRenamed(const QString &oldName, const QString &newName)
Emitted whenever label settings have been renamed from oldName to newName.
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 symbolRenamed(const QString &oldName, const QString &newName)
Emitted whenever a symbol has been renamed from oldName to newName.
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.
@ LabelSettingsXML
Label settings definition (as XML)
void rampRemoved(const QString &name)
Emitted whenever a color ramp has been removed from the style and the database has been updated as a ...
TagmapTable
Columns available in the tag to symbol table.
A legend patch shape entity for QgsStyle databases.
SymbolType
Type of the symbol.
void rampChanged(const QString &name)
Emitted whenever a color ramp's definition is changed.
ColorrampTable
Columns available in the color ramp table.
const QgsPalLayerSettings & settings() const
Returns the entity's label settings.
@ SmartgroupName
Smart group name.
void textFormatRemoved(const QString &name)
Emitted whenever a text format has been removed from the style and the database has been updated as a...
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...
@ LabelSettingsFavoriteId
Label settings is favorite flag.
QMultiMap< QString, QString > QgsSmartConditionMap
A multimap to hold the smart group conditions as constraint and parameter pairs.
Qgs3D is a singleton class containing various registries and other global members related to 3D class...
@ TagmapSymbolId
Symbol ID.
TagTable
Columns available in the Tags table.
@ TextFormatId
Text format ID.
void symbolRemoved(const QString &name)
Emitted whenever a symbol has been removed from the style and the database has been updated as a resu...
QgsStyleColorRampEntity(QgsColorRamp *ramp)
Constructor for QgsStyleColorRampEntity, with the specified color ramp.
StyleEntity
Enum for Entities involved in a style.