Class: QgsProjectStyleSettings¶
- class qgis.core.QgsProjectStyleSettings¶
Bases:
PyQt5.QtCore.QObject
Contains settings and properties relating to how a
QgsProject
should handle styling.New in version 3.26.
QgsProjectStyleSettings(project:
QgsProject
= None) Constructor forQgsProjectStyleSettings
for the specifiedproject
.Ownership is transferred to the
project
.Methods
Adds a style database
path
to the project.Returns the combined style model which includes all style databases associated with the project.
Returns the project default color ramp.
Returns the project default symbol for a given type.
Returns the default symbol opacity.
Returns the project default text format.
Returns the style database to use for project specific styles.
Returns whether the default symbol fill color is randomized.
Reads the settings's state from a DOM element.
Resets the settings to a default state.
Sets the project default color ramp.
Sets the project default symbol for a given type.
Sets the default symbol opacity.
Sets the project default text format.
Sets the style database to use for the project style.
Sets whether the default symbol fill color is randomized.
Sets the
paths
to all style databases associated with the project.Returns a reference to the style database associated with the project with matching file
path
.Returns a list of all style databases (file paths) associated with the project.
Returns a list of all the styles associated with the project.
Returns a DOM element representing the settings.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- addStyleDatabasePath(self, path: str)¶
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.
See also
See also
See also
- Parameters:
path (str) –
- childEvent(self, QChildEvent)¶
- combinedStyleModel(self) QgsCombinedStyleModel ¶
Returns the combined style model which includes all style databases associated with the project.
This model also includes
QgsStyle.defaultStyle()
.Note
This is only available on builds based on Qt 5.13 or later.
See also
- Return type:
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- defaultColorRamp(self) QgsColorRamp ¶
Returns the project default color ramp.
- Return type:
- Returns:
a color ramp pointer or NULL if there is no default set
Note
the color ramp ownership is transferred to the caller
- defaultSymbol(self, symbolType: Qgis.SymbolType) QgsSymbol ¶
Returns the project default symbol for a given type.
- Parameters:
symbolType (Qgis.SymbolType) – the symbol type
- Return type:
- Returns:
a symbol pointer or NULL if there is no default set
Note
the symbol ownership is transferred to the caller
- defaultSymbolOpacity(self) float ¶
Returns the default symbol opacity.
- Return type:
float
- defaultTextFormat(self) QgsTextFormat ¶
Returns the project default text format.
Note
if no default is defined, the returned format will be invalid
- Return type:
- disconnectNotify(self, QMetaMethod)¶
- isSignalConnected(self, QMetaMethod) bool ¶
- projectStyle(self) QgsStyle ¶
Returns the style database to use for project specific styles.
See also
- Return type:
- randomizeDefaultSymbolColor(self) bool ¶
Returns whether the default symbol fill color is randomized.
- Return type:
bool
- readXml(self, element: QDomElement, context: QgsReadWriteContext, flags: Qgis.ProjectReadFlags | Qgis.ProjectReadFlag = Qgis.ProjectReadFlags()) bool ¶
Reads the settings’s state from a DOM element.
See also
- Parameters:
element (QDomElement) –
context (QgsReadWriteContext) –
flags (Union[Qgis.ProjectReadFlags) –
- Return type:
bool
- receivers(self, PYQT_SIGNAL) int ¶
- reset(self)¶
Resets the settings to a default state.
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setDefaultColorRamp(self, colorRamp: QgsColorRamp)¶
Sets the project default color ramp.
- Parameters:
colorRamp (QgsColorRamp) – the color ramp, set to NULL to clear default
Note
the color ramp ownership is not transferred
- setDefaultSymbol(self, symbolType: Qgis.SymbolType, symbol: QgsSymbol)¶
Sets the project default symbol for a given type.
- Parameters:
symbolType (Qgis.SymbolType) – the symbol type
symbol (QgsSymbol) – the symbol pointer, set to NULL to clear default
Note
the symbol ownership is not transferred
- setDefaultSymbolOpacity(self, opacity: float)¶
Sets the default symbol opacity.
- Parameters:
opacity (float) –
- setDefaultTextFormat(self, textFormat: QgsTextFormat)¶
Sets the project default text format.
- Parameters:
textFormat (QgsTextFormat) – the text format, an invalid format is interpreted as no default
- setProjectStyle(self, style: QgsStyle)¶
Sets the style database to use for the project style.
See also
- Parameters:
style (QgsStyle) –
- setRandomizeDefaultSymbolColor(self, randomized: bool)¶
Sets whether the default symbol fill color is randomized.
- Parameters:
randomized (bool) –
- setStyleDatabasePaths(self, paths: Iterable[str])¶
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.
See also
See also
See also
- Parameters:
paths (Iterable[str]) –
- styleAtPath(self, path: str) QgsStyle ¶
Returns a reference to the style database associated with the project with matching file
path
.- Parameters:
path (str) –
- Return type:
- styleDatabasePaths(self) List[str] ¶
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.
See also
See also
See also
- Return type:
List[str]
- styleDatabasesChanged¶
pyqtSignal(*types, name: str = …, revision: int = …, arguments: Sequence = …) -> PYQT_SIGNAL
types is normally a sequence of individual types. Each type is either a type object or a string that is the name of a C++ type. Alternatively each type could itself be a sequence of types each describing a different overloaded signal. name is the optional C++ name of the signal. If it is not specified then the name of the class attribute that is bound to the signal is used. revision is the optional revision of the signal that is exported to QML. If it is not specified then 0 is used. arguments is the optional sequence of the names of the signal’s arguments.
- Parameters:
name (str = ...) –
revision (int = ...) –
arguments (Sequence = ...) –
- Return type:
PYQT_SIGNAL
- styles(self) List[QgsStyle] ¶
Returns a list of all the styles associated with the project.
See also
- Return type:
List[QgsStyle]
- timerEvent(self, QTimerEvent)¶
- writeXml(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement ¶
Returns a DOM element representing the settings.
See also
- Parameters:
doc (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
QDomElement