QGIS API Documentation
3.26.3-Buenos Aires (65e4edfdad)
|
Contains settings and properties relating to how a QgsProject should handle styling. More...
#include <qgsprojectstylesettings.h>
Signals | |
void | projectStyleChanged () |
Emitted when the style returned by projectStyle() is changed. More... | |
void | styleDatabaseAboutToBeAdded (const QString &path) |
Emitted when a style database path is about to be added. More... | |
void | styleDatabaseAboutToBeRemoved (const QString &path) |
Emitted when a style database path is about to be removed. More... | |
void | styleDatabaseAdded (const QString &path) |
Emitted when a style database path is added. More... | |
void | styleDatabaseRemoved (const QString &path) |
Emitted when a style database path is removed. More... | |
void | styleDatabasesChanged () |
Emitted whenever the set of style databases associated with the project is changed. More... | |
Public Member Functions | |
QgsProjectStyleSettings (QgsProject *project=nullptr) | |
Constructor for QgsProjectStyleSettings for the specified project. More... | |
~QgsProjectStyleSettings () override | |
void | addStyleDatabasePath (const QString &path) |
Adds a style database path to the project. More... | |
QgsCombinedStyleModel * | combinedStyleModel () |
Returns the combined style model which includes all style databases associated with the project. More... | |
QgsColorRamp * | defaultColorRamp () const SIP_FACTORY |
Returns the project default color ramp. More... | |
QgsSymbol * | defaultSymbol (Qgis::SymbolType symbolType) const SIP_FACTORY |
Returns the project default symbol for a given type. More... | |
double | defaultSymbolOpacity () const |
Returns the default symbol opacity. More... | |
QgsTextFormat | defaultTextFormat () const |
Returns the project default text format. More... | |
QgsStyle * | projectStyle () |
Returns the style database to use for project specific styles. More... | |
bool | randomizeDefaultSymbolColor () const |
Returns whether the default symbol fill color is randomized. More... | |
bool | readXml (const QDomElement &element, const QgsReadWriteContext &context, Qgis::ProjectReadFlags flags=Qgis::ProjectReadFlags()) |
Reads the settings's state from a DOM element. More... | |
void | reset () |
Resets the settings to a default state. More... | |
void | setDefaultColorRamp (QgsColorRamp *colorRamp) |
Sets the project default color ramp. More... | |
void | setDefaultSymbol (Qgis::SymbolType symbolType, QgsSymbol *symbol) |
Sets the project default symbol for a given type. More... | |
void | setDefaultSymbolOpacity (double opacity) |
Sets the default symbol opacity. More... | |
void | setDefaultTextFormat (const QgsTextFormat &textFormat) |
Sets the project default text format. More... | |
void | setProjectStyle (QgsStyle *style SIP_TRANSFER) |
Sets the style database to use for the project style. More... | |
void | setRandomizeDefaultSymbolColor (bool randomized) |
Sets whether the default symbol fill color is randomized. More... | |
void | setStyleDatabasePaths (const QStringList &paths) |
Sets the paths to all style databases associated with the project. More... | |
QgsStyle * | styleAtPath (const QString &path) |
Returns a reference to the style database associated with the project with matching file path. More... | |
QStringList | styleDatabasePaths () const |
Returns a list of all style databases (file paths) associated with the project. More... | |
QList< QgsStyle * > | styles () const |
Returns a list of all the styles associated with the project. More... | |
QDomElement | writeXml (QDomDocument &doc, const QgsReadWriteContext &context) const |
Returns a DOM element representing the settings. More... | |
Contains settings and properties relating to how a QgsProject should handle styling.
Definition at line 43 of file qgsprojectstylesettings.h.
QgsProjectStyleSettings::QgsProjectStyleSettings | ( | QgsProject * | project = nullptr | ) |
Constructor for QgsProjectStyleSettings for the specified project.
Ownership is transferred to the project.
Definition at line 34 of file qgsprojectstylesettings.cpp.
|
override |
Definition at line 43 of file qgsprojectstylesettings.cpp.
void QgsProjectStyleSettings::addStyleDatabasePath | ( | const QString & | path | ) |
Adds a style database path to the project.
Paths can be either style .db databases, or .xml exports of style databases.
The file path added by this method must always be absolute paths. Depending on the project settings, they may be converted to relative paths when the project is saved.
Definition at line 354 of file qgsprojectstylesettings.cpp.
QgsCombinedStyleModel * QgsProjectStyleSettings::combinedStyleModel | ( | ) |
Returns the combined style model which includes all style databases associated with the project.
This model also includes QgsStyle::defaultStyle().
Definition at line 444 of file qgsprojectstylesettings.cpp.
QgsColorRamp * QgsProjectStyleSettings::defaultColorRamp | ( | ) | const |
Returns the project default color ramp.
Definition at line 93 of file qgsprojectstylesettings.cpp.
QgsSymbol * QgsProjectStyleSettings::defaultSymbol | ( | Qgis::SymbolType | symbolType | ) | const |
Returns the project default symbol for a given type.
symbolType | the symbol type |
Definition at line 52 of file qgsprojectstylesettings.cpp.
|
inline |
Returns the default symbol opacity.
Definition at line 113 of file qgsprojectstylesettings.h.
QgsTextFormat QgsProjectStyleSettings::defaultTextFormat | ( | ) | const |
Returns the project default text format.
Definition at line 103 of file qgsprojectstylesettings.cpp.
QgsStyle * QgsProjectStyleSettings::projectStyle | ( | ) |
Returns the style database to use for project specific styles.
Definition at line 163 of file qgsprojectstylesettings.cpp.
|
signal |
Emitted when the style returned by projectStyle() is changed.
|
inline |
Returns whether the default symbol fill color is randomized.
Definition at line 103 of file qgsprojectstylesettings.h.
bool QgsProjectStyleSettings::readXml | ( | const QDomElement & | element, |
const QgsReadWriteContext & | context, | ||
Qgis::ProjectReadFlags | flags = Qgis::ProjectReadFlags() |
||
) |
Reads the settings's state from a DOM element.
Definition at line 168 of file qgsprojectstylesettings.cpp.
void QgsProjectStyleSettings::reset | ( | ) |
Resets the settings to a default state.
Definition at line 113 of file qgsprojectstylesettings.cpp.
void QgsProjectStyleSettings::setDefaultColorRamp | ( | QgsColorRamp * | colorRamp | ) |
Sets the project default color ramp.
colorRamp | the color ramp, set to NULL to clear default |
Definition at line 98 of file qgsprojectstylesettings.cpp.
void QgsProjectStyleSettings::setDefaultSymbol | ( | Qgis::SymbolType | symbolType, |
QgsSymbol * | symbol | ||
) |
Sets the project default symbol for a given type.
symbolType | the symbol type |
symbol | the symbol pointer, set to NULL to clear default |
Definition at line 72 of file qgsprojectstylesettings.cpp.
|
inline |
Sets the default symbol opacity.
Definition at line 118 of file qgsprojectstylesettings.h.
void QgsProjectStyleSettings::setDefaultTextFormat | ( | const QgsTextFormat & | textFormat | ) |
Sets the project default text format.
textFormat | the text format, an invalid format is interpreted as no default |
Definition at line 108 of file qgsprojectstylesettings.cpp.
void QgsProjectStyleSettings::setProjectStyle | ( | QgsStyle *style | SIP_TRANSFER | ) |
Sets the style database to use for the project style.
Definition at line 138 of file qgsprojectstylesettings.cpp.
|
inline |
Sets whether the default symbol fill color is randomized.
Definition at line 108 of file qgsprojectstylesettings.h.
void QgsProjectStyleSettings::setStyleDatabasePaths | ( | const QStringList & | paths | ) |
Sets the paths to all style databases associated with the project.
Paths can be either style .db databases, or .xml exports of style databases.
The file paths set by this method must always be absolute paths. Depending on the project settings, they may be converted to relative paths when the project is saved.
Definition at line 367 of file qgsprojectstylesettings.cpp.
QgsStyle * QgsProjectStyleSettings::styleAtPath | ( | const QString & | path | ) |
Returns a reference to the style database associated with the project with matching file path.
Definition at line 337 of file qgsprojectstylesettings.cpp.
|
signal |
Emitted when a style database path is about to be added.
|
signal |
Emitted when a style database path is about to be removed.
|
signal |
Emitted when a style database path is added.
|
inline |
Returns a list of all style databases (file paths) associated with the project.
The file paths returned by this method will always be absolute paths. Depending on the project settings, they may be converted to relative paths when the project is saved.
Definition at line 161 of file qgsprojectstylesettings.h.
|
signal |
Emitted when a style database path is removed.
|
signal |
Emitted whenever the set of style databases associated with the project is changed.
QList< QgsStyle * > QgsProjectStyleSettings::styles | ( | ) | const |
Returns a list of all the styles associated with the project.
Definition at line 325 of file qgsprojectstylesettings.cpp.
QDomElement QgsProjectStyleSettings::writeXml | ( | QDomDocument & | doc, |
const QgsReadWriteContext & | context | ||
) | const |
Returns a DOM element representing the settings.
Definition at line 266 of file qgsprojectstylesettings.cpp.