19 #include "qgis_core.h" 58 #define QGSCLIPBOARD_STYLE_MIME "application/qgis.style" 231 bool addTextFormat(
const QString &name,
const QgsTextFormat &format,
bool update =
false );
243 bool addLabelSettings(
const QString &name,
const QgsPalLayerSettings &settings,
bool update =
false );
251 int addTag(
const QString &tagName );
276 int addSmartgroup(
const QString &name,
const QString &op,
const QStringList &matchTag,
const QStringList &noMatchTag,
277 const QStringList &matchName,
const QStringList &noMatchName );
285 QStringList tags()
const;
297 int colorRampCount();
300 QStringList colorRampNames()
const;
303 const QgsColorRamp *colorRampRef(
const QString &name )
const;
309 int colorrampId(
const QString &name );
322 int textFormatCount()
const;
328 QStringList textFormatNames()
const;
336 int textFormatId(
const QString &name );
358 int labelSettingsCount()
const;
364 QStringList labelSettingsNames()
const;
372 int labelSettingsId(
const QString &name );
378 static void cleanDefaultStyle() SIP_SKIP;
389 bool tagSymbol(
StyleEntity type, const QString &symbol, const QStringList &tags );
400 bool detagSymbol(
StyleEntity type, const QString &symbol, const QStringList &tags );
410 bool detagSymbol(
StyleEntity type, const QString &symbol );
413 bool removeSymbol( const QString &name );
420 bool renameSymbol( const QString &oldName, const QString &newName );
423 QgsSymbol *symbol( const QString &name ) SIP_FACTORY;
426 const
QgsSymbol *symbolRef( const QString &name ) const;
432 QStringList symbolNames() const;
438 int symbolId( const QString &name );
440 int tagId( const QString &tag );
442 int smartgroupId( const QString &smartgroup );
456 QStringList symbolsOfFavorite(
StyleEntity type ) const;
465 QStringList symbolsWithTag(
StyleEntity type,
int tagid ) const;
474 bool addFavorite(
StyleEntity type, const QString &name );
483 bool removeFavorite(
StyleEntity type, const QString &name );
492 bool rename(
StyleEntity type,
int id, const QString &newName );
511 bool saveSymbol( const QString &name,
QgsSymbol *symbol,
bool favorite, const QStringList &tags );
522 bool saveColorRamp( const QString &name,
QgsColorRamp *ramp,
bool favorite, const QStringList &tags );
525 bool removeColorRamp( const QString &name );
528 bool renameColorRamp( const QString &oldName, const QString &newName );
539 bool saveTextFormat( const QString &name, const
QgsTextFormat &format,
bool favorite, const QStringList &tags );
545 bool removeTextFormat( const QString &name );
552 bool renameTextFormat( const QString &oldName, const QString &newName );
563 bool saveLabelSettings( const QString &name, const
QgsPalLayerSettings &settings,
bool favorite, const QStringList &tags );
569 bool removeLabelSettings( const QString &name );
576 bool renameLabelSettings( const QString &oldName, const QString &newName );
586 bool createDatabase( const QString &filename );
596 bool createMemoryDatabase();
616 bool load( const QString &filename );
619 bool save( QString filename = QString() );
622 QString errorString() {
return mErrorString; }
634 QStringList findSymbols(
StyleEntity type,
const QString &qword );
643 QStringList tagsOfSymbol(
StyleEntity type,
const QString &symbol );
651 bool isFavorite(
StyleEntity type,
const QString &name );
661 bool symbolHasTag(
StyleEntity type,
const QString &symbol,
const QString &tag );
664 QString tag(
int id )
const;
670 QStringList smartgroupNames()
const;
679 QString smartgroupOperator(
int id );
682 QStringList symbolsOfSmartgroup(
StyleEntity type,
int id );
685 bool exportXml(
const QString &filename );
688 bool importXml(
const QString &filename );
698 static bool isXmlStyleFile(
const QString &path );
710 void symbolSaved(
const QString &name,
QgsSymbol *symbol );
720 void symbolChanged(
const QString &name );
723 void groupsModified();
730 void entityTagsChanged(
QgsStyle::StyleEntity entity,
const QString &name,
const QStringList &newTags );
746 void symbolRemoved(
const QString &name );
753 void symbolRenamed(
const QString &oldName,
const QString &newName );
760 void rampRenamed(
const QString &oldName,
const QString &newName );
769 void rampAdded(
const QString &name );
778 void rampRemoved(
const QString &name );
788 void rampChanged(
const QString &name );
796 void textFormatRenamed(
const QString &oldName,
const QString &newName );
805 void textFormatAdded(
const QString &name );
814 void textFormatRemoved(
const QString &name );
824 void textFormatChanged(
const QString &name );
831 void labelSettingsRenamed(
const QString &oldName,
const QString &newName );
840 void labelSettingsAdded(
const QString &name );
849 void labelSettingsRemoved(
const QString &name );
859 void labelSettingsChanged(
const QString &name );
868 QHash< QString, QStringList > mCachedSymbolTags;
869 QHash< QString, QStringList > mCachedColorRampTags;
870 QHash< QString, QStringList > mCachedTextFormatTags;
871 QHash< QString, QStringList > mCachedLabelSettingsTags;
873 QHash< QString, bool > mCachedSymbolFavorites;
874 QHash< QString, bool > mCachedColorRampFavorites;
875 QHash< QString, bool > mCachedTextFormatFavorites;
876 QHash< QString, bool > mCachedLabelSettingsFavorites;
878 QString mErrorString;
886 bool openDatabase(
const QString &filename );
894 bool runEmptyQuery(
const QString &query );
897 int getId(
const QString &table,
const QString &name );
900 QString getName(
const QString &table,
int id )
const;
910 bool updateSymbol(
StyleEntity type,
const QString &name );
912 void clearCachedTags(
StyleEntity type,
const QString &name );
928 switch ( sipCpp->type() )
931 sipType = sipType_QgsStyleSymbolEntity;
935 sipType = sipType_QgsStyleColorRampEntity;
939 sipType = sipType_QgsStyleTextFormatEntity;
943 sipType = sipType_QgsStyleLabelSettingsEntity;
1072 : mSettings( settings )
TagmapTable
Columns available in the tag to symbol table.
Text format is favorite flag.
A symbol entity for QgsStyle databases.
QgsStyleColorRampEntity(const QgsColorRamp *ramp)
Constructor for QgsStyleColorRampEntity, with the specified color ramp.
const QgsSymbol * symbol() const
Returns the entity's symbol.
Abstract base class for all rendered symbols.
An interface for entities which can be placed in a QgsStyle database.
QgsStyleSymbolEntity(const QgsSymbol *symbol)
Constructor for QgsStyleSymbolEntity, with the specified symbol.
QMap< QString, QgsPalLayerSettings > QgsLabelSettingsMap
Map of name to label settings.
Abstract base class for color ramps.
QMap< int, QString > QgsSymbolGroupMap
Smart group definition (as XML)
const QgsColorRamp * ramp() const
Returns the entity's color ramp.
Symbol definition (as XML)
SmartgroupTable
Columns available in the smart group table.
StyleEntity
Enum for Entities involved in a style.
TextFormatTable
Columns available in the text format table.
const QgsPalLayerSettings & settings() const
Returns the entity's label settings.
QgsTextFormat format() const
Returns the entity's text format.
QgsStyleLabelSettingsEntity(const QgsPalLayerSettings &settings)
Constructor for QgsStyleLabelSettingsEntity, with the specified label settings.
TagTable
Columns available in the Tags table.
A text format entity for QgsStyle databases.
QMap< QString, QgsTextFormat > QgsTextFormatMap
Map of name to text format.
Unique pointer for sqlite3 databases, which automatically closes the database when the pointer goes o...
GeometryType
The geometry types are used to group QgsWkbTypes::Type in a coarse way.
virtual QgsStyle::StyleEntity type() const =0
Returns the type of style entity.
Text format definition (as XML)
ColorrampTable
Columns available in the color ramp table.
QMap< QString, QgsColorRamp *> QgsVectorColorRampMap
QString fileName()
Returns current file name of the style.
A label settings entity for QgsStyle databases.
#define SIP_CONVERT_TO_SUBCLASS_CODE(code)
QMap< QString, QgsSymbol *> QgsSymbolMap
SymbolTable
Columns available in the Symbols table.
Label settings is favorite flag.
LabelSettingsTable
Columns available in the label settings table.
A color ramp entity for QgsStyle databases.
Container for all settings relating to text rendering.
Label settings definition (as XML)
Color ramp is favorite flag.
QgsStyleTextFormatEntity(const QgsTextFormat &format)
Constructor for QgsStyleTextFormatEntity, with the specified text format.
Color ramp definition (as XML)
QMultiMap< QString, QString > QgsSmartConditionMap
A multimap to hold the smart group conditions as constraint and parameter pairs.