QGIS API Documentation 4.1.0-Master (467af3bbe65)
Loading...
Searching...
No Matches
qgsstyle.h
Go to the documentation of this file.
1/***************************************************************************
2 qgsstyle.h
3 ---------------------
4 begin : November 2009
5 copyright : (C) 2009 by Martin Dobias
6 email : wonder dot sk at gmail dot com
7 ***************************************************************************
8 * *
9 * This program is free software; you can redistribute it and/or modify *
10 * it under the terms of the GNU General Public License as published by *
11 * the Free Software Foundation; either version 2 of the License, or *
12 * (at your option) any later version. *
13 * *
14 ***************************************************************************/
15
16#ifndef QGSSTYLE_H
17#define QGSSTYLE_H
18
19#include <sqlite3.h>
20
21#include "qgis.h"
22#include "qgis_core.h"
23#include "qgslegendpatchshape.h"
24#include "qgspallabeling.h"
25#include "qgssqliteutils.h"
26#include "qgssymbollayerutils.h"
27#include "qgstextformat.h"
28
29#include <QMap>
30#include <QMultiMap>
31#include <QString>
32
33class QgsSymbol;
34class QgsSymbolLayer;
35class QgsColorRamp;
38class QDomDocument;
39class QDomElement;
41
42typedef QMap<QString, QgsColorRamp * > QgsVectorColorRampMap;
43typedef QMap<int, QString> QgsSymbolGroupMap;
44
49typedef QMap<QString, QgsTextFormat > QgsTextFormatMap;
50
55typedef QMap<QString, QgsPalLayerSettings > QgsLabelSettingsMap;
56
57
58/*
59 * Constants used to describe copy-paste MIME types
60 */
61#define QGSCLIPBOARD_STYLE_MIME "application/qgis.style"
62#define QGSCLIPBOARD_STYLES_MIME "application/qgis.styles"
63
82typedef QMultiMap<QString, QString> QgsSmartConditionMap;
83
84
90class CORE_EXPORT QgsStyle : public QObject
91{
92 Q_OBJECT
93
94 public:
100 enum class SymbolTableColumn : int
101 {
102 Id,
103 Name,
104 XML,
105 FavoriteId,
106 };
107 Q_ENUM( SymbolTableColumn )
108
109
114 enum class TagTableColumn : int
115 {
116 Id,
117 Name,
118 };
119 Q_ENUM( TagTableColumn )
120
121
126 enum class TagmapTableColumn : int
127 {
128 TagId,
129 SymbolId,
130 };
131 Q_ENUM( TagmapTableColumn )
132
133
138 enum class ColorRampTableColumn : int
139 {
140 Id,
141 Name,
142 XML,
143 FavoriteId,
144 };
145 Q_ENUM( ColorRampTableColumn )
146
147
152 enum class TextFormatTableColumn : int
153 {
154 Id,
155 Name,
156 XML,
157 FavoriteId,
158 };
159 Q_ENUM( TextFormatTableColumn )
160
161
167 {
168 Id,
169 Name,
170 XML,
171 FavoriteId,
172 };
173 Q_ENUM( LabelSettingsTableColumn )
174
175
180 enum class SmartGroupTableColumn : int
181 {
182 Id,
183 Name,
184 XML,
185 };
186 Q_ENUM( SmartGroupTableColumn )
187
188
191 QgsStyle( QObject *parent SIP_TRANSFERTHIS = nullptr );
192 ~QgsStyle() override;
193
217
224 QString name() const;
225
232 void setName( const QString &name );
233
243 bool isInitialized() const { return mInitialized; }
244
254 bool isReadOnly() const;
255
265 void setReadOnly( bool readOnly );
266
278 bool addEntity( const QString &name, const QgsStyleEntityInterface *entity, bool update = false );
279
289 bool addSymbol( const QString &name, QgsSymbol *symbol SIP_TRANSFER, bool update = false );
290
299 bool addColorRamp( const QString &name, QgsColorRamp *colorRamp SIP_TRANSFER, bool update = false );
300
311 bool addTextFormat( const QString &name, const QgsTextFormat &format, bool update = false );
312
323 bool addLabelSettings( const QString &name, const QgsPalLayerSettings &settings, bool update = false );
324
335 bool addLegendPatchShape( const QString &name, const QgsLegendPatchShape &shape, bool update = false );
336
347 bool addSymbol3D( const QString &name, QgsAbstract3DSymbol *symbol SIP_TRANSFER, bool update = false );
348
361 bool addMaterialSettings( const QString &name, QgsAbstractMaterialSettings *settings SIP_TRANSFER, bool update = false );
362
369 int addTag( const QString &tagName );
370
380 int addSmartgroup( const QString &name, const QString &op, const QgsSmartConditionMap &conditions ) SIP_SKIP;
381
394 int addSmartgroup( const QString &name, const QString &op, const QStringList &matchTag, const QStringList &noMatchTag, const QStringList &matchName, const QStringList &noMatchName );
395
401 QStringList tags() const;
402
404 void clear();
405
410 QgsColorRamp *colorRamp( const QString &name ) const SIP_FACTORY;
411
413 int colorRampCount();
414
416 QStringList colorRampNames() const;
417
419 const QgsColorRamp *colorRampRef( const QString &name ) const;
420
425 int colorrampId( const QString &name );
426
432 QgsTextFormat textFormat( const QString &name ) const;
433
438 int textFormatCount() const;
439
444 QStringList textFormatNames() const;
445
452 int textFormatId( const QString &name );
453
459 QgsPalLayerSettings labelSettings( const QString &name ) const;
460
466 QgsLegendPatchShape legendPatchShape( const QString &name ) const;
467
472 int legendPatchShapesCount() const;
473
481 Qgis::SymbolType legendPatchShapeSymbolType( const QString &name ) const;
482
488 QgsAbstract3DSymbol *symbol3D( const QString &name ) const SIP_FACTORY;
489
494 int symbol3DCount() const;
495
502 QList< Qgis::GeometryType > symbol3DCompatibleGeometryTypes( const QString &name ) const;
503
511 Qgis::GeometryType labelSettingsLayerType( const QString &name ) const;
512
517 int labelSettingsCount() const;
518
523 QStringList labelSettingsNames() const;
524
531 int labelSettingsId( const QString &name );
532
541 static QgsStyle *defaultStyle( bool initialize = true );
542
544 static void cleanDefaultStyle() SIP_SKIP;
545
555 bool tagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
556
566 bool detagSymbol( StyleEntity type, const QString &symbol, const QStringList &tags );
567
576 bool detagSymbol( StyleEntity type, const QString &symbol );
577
579 bool removeSymbol( const QString &name );
580
588 bool renameEntity( StyleEntity type, const QString &oldName, const QString &newName );
589
595 bool renameSymbol( const QString &oldName, const QString &newName );
596
598 QgsSymbol *symbol( const QString &name ) SIP_FACTORY;
599
601 const QgsSymbol *symbolRef( const QString &name ) const;
602
604 int symbolCount();
605
607 QStringList symbolNames() const;
608
613 int symbolId( const QString &name );
614
619 int entityId( StyleEntity type, const QString &name );
620
622 int tagId( const QString &tag );
624 int smartgroupId( const QString &smartgroup );
625
630 QStringList allNames( StyleEntity type ) const;
631
638 QStringList symbolsOfFavorite( StyleEntity type ) const;
639
647 QStringList symbolsWithTag( StyleEntity type, int tagid ) const;
648
656 bool addFavorite( StyleEntity type, const QString &name );
657
665 bool removeFavorite( StyleEntity type, const QString &name );
666
674 bool rename( StyleEntity type, int id, const QString &newName );
675
684 bool remove( StyleEntity type, int id );
685
692 bool removeEntityByName( StyleEntity type, const QString &name );
693
703 bool saveSymbol( const QString &name, const QgsSymbol *symbol, bool favorite, const QStringList &tags );
704
714 bool saveColorRamp( const QString &name, const QgsColorRamp *ramp, bool favorite, const QStringList &tags );
715
717 bool removeColorRamp( const QString &name );
718
720 bool renameColorRamp( const QString &oldName, const QString &newName );
721
731 bool saveTextFormat( const QString &name, const QgsTextFormat &format, bool favorite, const QStringList &tags );
732
737 bool removeTextFormat( const QString &name );
738
744 bool renameTextFormat( const QString &oldName, const QString &newName );
745
755 bool saveLabelSettings( const QString &name, const QgsPalLayerSettings &settings, bool favorite, const QStringList &tags );
756
761 bool removeLabelSettings( const QString &name );
762
768 bool renameLabelSettings( const QString &oldName, const QString &newName );
769
781 bool saveLegendPatchShape( const QString &name, const QgsLegendPatchShape &shape, bool favorite, const QStringList &tags );
782
788 bool renameLegendPatchShape( const QString &oldName, const QString &newName );
789
794 QStringList legendPatchShapeNames() const;
795
803 const QgsSymbol *previewSymbolForPatchShape( const QgsLegendPatchShape &shape ) const;
804
811 QgsLegendPatchShape defaultPatch( Qgis::SymbolType type, QSizeF size ) const;
812
819 QList< QList< QPolygonF > > defaultPatchAsQPolygonF( Qgis::SymbolType type, QSizeF size ) const;
820
826 enum class TextFormatContext : int
827 {
828 Labeling,
829 };
830
837
843 static QgsTextFormat defaultTextFormatForProject( QgsProject *project, QgsStyle::TextFormatContext context = QgsStyle::TextFormatContext::Labeling );
844
856 bool saveSymbol3D( const QString &name, QgsAbstract3DSymbol *symbol SIP_TRANSFER, bool favorite, const QStringList &tags );
857
863 bool renameSymbol3D( const QString &oldName, const QString &newName );
864
869 QStringList symbol3DNames() const;
870
882 bool saveMaterialSettings( const QString &name, QgsAbstractMaterialSettings *settings SIP_TRANSFER, bool favorite, const QStringList &tags );
883
889 bool renameMaterialSettings( const QString &oldName, const QString &newName );
890
895 QStringList materialSettingsNames() const;
896
901 int materialSettingsCount() const;
902
908 std::unique_ptr< QgsAbstractMaterialSettings > materialSettings( const QString &name ) const;
909
917 bool createDatabase( const QString &filename );
918
926 bool createMemoryDatabase();
927
935 void createTables();
936
947 bool load( const QString &filename );
948
963 Q_DECL_DEPRECATED bool save( const QString &filename = QString() ) SIP_DEPRECATED;
964
970 QString errorString() const { return mErrorString; }
971
981 QString fileName() const { return mFileName; }
982
994 void setFileName( const QString &filename );
995
1003 QStringList findSymbols( StyleEntity type, const QString &qword );
1004
1012 QStringList tagsOfSymbol( StyleEntity type, const QString &symbol );
1013
1020 bool isFavorite( StyleEntity type, const QString &name );
1021
1030 bool symbolHasTag( StyleEntity type, const QString &symbol, const QString &tag );
1031
1033 QString tag( int id ) const;
1034
1036 QgsSymbolGroupMap smartgroupsListMap();
1037
1039 QStringList smartgroupNames() const;
1040
1042 QgsSmartConditionMap smartgroup( int id );
1043
1047 QString smartgroupOperator( int id );
1048
1050 QStringList symbolsOfSmartgroup( StyleEntity type, int id );
1051
1053 bool exportXml( const QString &filename );
1054
1056 bool importXml( const QString &filename );
1057
1066 static bool isXmlStyleFile( const QString &path );
1067
1068 public slots:
1069#ifndef SIP_RUN
1070
1078 void triggerIconRebuild();
1079#endif
1080
1081 signals:
1082
1092
1103
1112 void symbolSaved( const QString &name, const QgsSymbol *symbol );
1113
1122 void symbolChanged( const QString &name );
1123
1126
1132 void entityTagsChanged( QgsStyle::StyleEntity entity, const QString &name, const QStringList &newTags );
1133
1139 void favoritedChanged( QgsStyle::StyleEntity entity, const QString &name, bool isFavorite );
1140
1146 void entityAdded( QgsStyle::StyleEntity entity, const QString &name );
1147
1154 void entityRemoved( QgsStyle::StyleEntity entity, const QString &name );
1155
1160 void entityRenamed( QgsStyle::StyleEntity entity, const QString &oldName, const QString &newName );
1161
1168 void entityChanged( QgsStyle::StyleEntity entity, const QString &name );
1169
1177 void symbolRemoved( const QString &name );
1178
1184 void symbolRenamed( const QString &oldName, const QString &newName );
1185
1191 void rampRenamed( const QString &oldName, const QString &newName );
1192
1200 void rampAdded( const QString &name );
1201
1209 void rampRemoved( const QString &name );
1210
1219 void rampChanged( const QString &name );
1220
1226 void textFormatRenamed( const QString &oldName, const QString &newName );
1227
1235 void textFormatAdded( const QString &name );
1236
1244 void textFormatRemoved( const QString &name );
1245
1254 void textFormatChanged( const QString &name );
1255
1261 void labelSettingsRenamed( const QString &oldName, const QString &newName );
1262
1270 void labelSettingsAdded( const QString &name );
1271
1279 void labelSettingsRemoved( const QString &name );
1280
1289 void labelSettingsChanged( const QString &name );
1290
1297
1298 private:
1299 bool mInitialized = true;
1300 QString mName;
1301 bool mReadOnly = false;
1302
1303 QgsSymbolMap mSymbols;
1304 QgsVectorColorRampMap mColorRamps;
1305 QgsTextFormatMap mTextFormats;
1306 QgsLabelSettingsMap mLabelSettings;
1307 QMap<QString, QgsLegendPatchShape > mLegendPatchShapes;
1308 QMap<QString, QgsAbstract3DSymbol * > m3dSymbols;
1309 QMap<QString, QgsAbstractMaterialSettings * > mMaterialSettings;
1310
1311 QHash< QgsStyle::StyleEntity, QHash< QString, QStringList > > mCachedTags;
1312 QHash< QgsStyle::StyleEntity, QHash< QString, bool > > mCachedFavorites;
1313
1314 QString mErrorString;
1315 QString mFileName;
1316
1317 sqlite3_database_unique_ptr mCurrentDB;
1318
1319 std::unique_ptr< QgsSymbol > mPatchMarkerSymbol;
1320 std::unique_ptr< QgsSymbol > mPatchLineSymbol;
1321 std::unique_ptr< QgsSymbol > mPatchFillSymbol;
1322
1323 mutable QHash< int, QHash< QSizeF, QgsLegendPatchShape > > mDefaultPatchCache;
1324 mutable QHash< int, QHash< QSizeF, QList< QList< QPolygonF > > > > mDefaultPatchQPolygonFCache;
1325
1326 QMap< QString, QDomElement > mDeferred3DsymbolElements;
1327 void handleDeferred3DSymbolCreation();
1328
1329 static QgsStyle *sDefaultStyle;
1330
1336 void initializeDefaultStyle( const QString &filename );
1337
1339 bool openDatabase( const QString &filename );
1340
1342 bool importXml( const QString &filename, int sinceVersion );
1343
1350 bool runEmptyQuery( const QString &query );
1351
1353 int getId( const QString &table, const QString &name );
1354
1356 QString getName( const QString &table, int id ) const;
1357
1366 bool updateSymbol( StyleEntity type, const QString &name );
1367
1368 void clearCachedTags( StyleEntity type, const QString &name );
1369
1373 bool createStyleMetadataTableIfNeeded();
1374 void upgradeIfRequired();
1375
1379 static QString entityTableName( StyleEntity type );
1380
1384 static QString tagmapTableName( StyleEntity type );
1385
1389 static QString tagmapEntityIdFieldName( StyleEntity type );
1390
1391 friend class Qgs3D;
1392 friend class TestStyle;
1393
1394 Q_DISABLE_COPY( QgsStyle )
1395};
1396
1404{
1405#ifdef SIP_RUN
1407 switch ( sipCpp->type() )
1408 {
1410 sipType = sipType_QgsStyleSymbolEntity;
1411 break;
1412
1414 sipType = sipType_QgsStyleColorRampEntity;
1415 break;
1416
1418 sipType = sipType_QgsStyleTextFormatEntity;
1419 break;
1420
1422 sipType = sipType_QgsStyleLabelSettingsEntity;
1423 break;
1424
1426 sipType = sipType_QgsStyleLegendPatchShapeEntity;
1427 break;
1428
1430 sipType = sipType_QgsStyleSymbol3DEntity;
1431 break;
1432
1434 sipType = sipType_QgsStyleMaterialSettingsEntity;
1435 break;
1436
1439 sipType = 0;
1440 break;
1441 }
1442 SIP_END
1443#endif
1444
1445 public:
1446
1447 virtual ~QgsStyleEntityInterface() = default;
1448
1452 virtual QgsStyle::StyleEntity type() const = 0;
1453};
1454
1462{
1463 public:
1470 : mSymbol( symbol )
1471 {}
1472
1473 QgsStyle::StyleEntity type() const override;
1474
1478 QgsSymbol *symbol() const { return mSymbol; }
1479
1480 private:
1481 QgsSymbol *mSymbol = nullptr;
1482};
1483
1491{
1492 public:
1499 : mRamp( ramp )
1500 {}
1501
1502 QgsStyle::StyleEntity type() const override;
1503
1507 QgsColorRamp *ramp() const { return mRamp; }
1508
1509 private:
1510 QgsColorRamp *mRamp = nullptr;
1511};
1512
1520{
1521 public:
1526 : mFormat( format )
1527 {}
1528
1529 QgsStyle::StyleEntity type() const override;
1530
1534 QgsTextFormat format() const { return mFormat; }
1535
1536 private:
1537 QgsTextFormat mFormat;
1538};
1539
1547{
1548 public:
1555
1556 QgsStyle::StyleEntity type() const override;
1557
1558
1562 const QgsPalLayerSettings &settings() const { return mSettings; }
1563
1564 private:
1565 QgsPalLayerSettings mSettings;
1566};
1567
1575{
1576 public:
1583
1584 QgsStyle::StyleEntity type() const override;
1585
1586
1590 const QgsLegendPatchShape &shape() const { return mShape; }
1591
1592 private:
1593 QgsLegendPatchShape mShape;
1594};
1595
1603{
1604 public:
1611 : mSymbol( symbol )
1612 {}
1613
1614 QgsStyle::StyleEntity type() const override;
1615
1619 const QgsAbstract3DSymbol *symbol() const { return mSymbol; }
1620
1621 private:
1622 const QgsAbstract3DSymbol *mSymbol = nullptr;
1623};
1624
1625
1633{
1634 public:
1643
1644 QgsStyle::StyleEntity type() const override;
1645
1649 const QgsAbstractMaterialSettings *settings() const { return mSettings; }
1650
1651 private:
1652 const QgsAbstractMaterialSettings *mSettings = nullptr;
1653};
1654
1655#endif
Provides global constants and enumerations for use throughout the application.
Definition qgis.h:62
GeometryType
The geometry types are used to group Qgis::WkbType in a coarse way.
Definition qgis.h:379
SymbolType
Symbol types.
Definition qgis.h:636
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,...
Definition qgsproject.h:113
QgsStyleColorRampEntity(QgsColorRamp *ramp)
Constructor for QgsStyleColorRampEntity, with the specified color ramp.
Definition qgsstyle.h:1498
QgsColorRamp * ramp() const
Returns the entity's color ramp.
Definition qgsstyle.h:1507
An interface for entities which can be placed in a QgsStyle database.
Definition qgsstyle.h:1404
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.
Definition qgsstyle.h:1562
QgsStyleLabelSettingsEntity(const QgsPalLayerSettings &settings)
Constructor for QgsStyleLabelSettingsEntity, with the specified label settings.
Definition qgsstyle.h:1552
const QgsLegendPatchShape & shape() const
Returns the entity's legend patch shape.
Definition qgsstyle.h:1590
QgsStyleLegendPatchShapeEntity(const QgsLegendPatchShape &shape)
Constructor for QgsStyleLegendPatchShapeEntity, with the specified legend patch shape.
Definition qgsstyle.h:1580
const QgsAbstractMaterialSettings * settings() const
Returns the entity's settings.
Definition qgsstyle.h:1649
QgsStyleMaterialSettingsEntity(const QgsAbstractMaterialSettings *settings)
Constructor for QgsStyleMaterialSettingsEntity, with the specified settings.
Definition qgsstyle.h:1640
const QgsAbstract3DSymbol * symbol() const
Returns the entity's symbol.
Definition qgsstyle.h:1619
QgsStyleSymbol3DEntity(const QgsAbstract3DSymbol *symbol)
Constructor for QgsStyleSymbol3DEntity, with the specified symbol.
Definition qgsstyle.h:1610
QgsStyleSymbolEntity(QgsSymbol *symbol)
Constructor for QgsStyleSymbolEntity, with the specified symbol.
Definition qgsstyle.h:1469
QgsSymbol * symbol() const
Returns the entity's symbol.
Definition qgsstyle.h:1478
QgsTextFormat format() const
Returns the entity's text format.
Definition qgsstyle.h:1534
QgsStyleTextFormatEntity(const QgsTextFormat &format)
Constructor for QgsStyleTextFormatEntity, with the specified text format.
Definition qgsstyle.h:1525
A database of saved style entities, including symbols, color ramps, text formats and others.
Definition qgsstyle.h:91
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.
Definition qgsstyle.h:970
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.
Definition qgsstyle.h:167
QgsSymbol * symbol(const QString &name)
Returns a NEW copy of symbol.
Definition qgsstyle.cpp:336
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.
Definition qgsstyle.h:206
@ LabelSettingsEntity
Label settings.
Definition qgsstyle.h:212
@ TextFormatEntity
Text formats.
Definition qgsstyle.h:211
@ SmartgroupEntity
Smart groups.
Definition qgsstyle.h:210
@ Symbol3DEntity
3D symbol entity
Definition qgsstyle.h:214
@ SymbolEntity
Symbols.
Definition qgsstyle.h:207
@ TagEntity
Tags.
Definition qgsstyle.h:208
@ ColorrampEntity
Color ramps.
Definition qgsstyle.h:209
@ LegendPatchShapeEntity
Legend patch shape.
Definition qgsstyle.h:213
@ MaterialSettingsEntity
Material settings.
Definition qgsstyle.h:215
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.
Definition qgsstyle.h:139
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.
Definition qgsstyle.h:153
QString fileName() const
Returns the current file name of the style database.
Definition qgsstyle.h:981
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.
Definition qgsstyle.h:243
SmartGroupTableColumn
Columns available in the smart group table.
Definition qgsstyle.h:181
TagTableColumn
Columns available in the Tags table.
Definition qgsstyle.h:115
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.
Definition qgsstyle.cpp:123
QgsStyle(QObject *parent=nullptr)
Constructor for QgsStyle, with the specified parent object.
Definition qgsstyle.cpp:97
SymbolTableColumn
Columns available in the Symbols table.
Definition qgsstyle.h:101
TagmapTableColumn
Columns available in the tag to symbol table.
Definition qgsstyle.h:127
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.
friend class Qgs3D
Definition qgsstyle.h:1391
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.
Definition qgsstyle.h:827
@ Labeling
Text format used in labeling.
Definition qgsstyle.h:828
void symbolRemoved(const QString &name)
Emitted whenever a symbol has been removed from the style and the database has been updated as a resu...
friend class TestStyle
Definition qgsstyle.h:1392
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.
Definition qgssymbol.h:227
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.
Definition qgsstyle.h:82
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
Definition qgis_sip.h:198
#define SIP_DEPRECATED
Definition qgis_sip.h:113
#define SIP_TRANSFERTHIS
Definition qgis_sip.h:52
#define SIP_SKIP
Definition qgis_sip.h:133
#define SIP_TRANSFER
Definition qgis_sip.h:35
#define SIP_FACTORY
Definition qgis_sip.h:83
#define SIP_END
Definition qgis_sip.h:215
QMap< QString, QgsSymbol * > QgsSymbolMap
Definition qgsrenderer.h:52
QMap< QString, QgsPalLayerSettings > QgsLabelSettingsMap
Map of name to label settings.
Definition qgsstyle.h:55
QMap< QString, QgsTextFormat > QgsTextFormatMap
Map of name to text format.
Definition qgsstyle.h:49
QMap< QString, QgsColorRamp * > QgsVectorColorRampMap
Definition qgsstyle.h:42
QMap< int, QString > QgsSymbolGroupMap
Definition qgsstyle.h:43