Class: QgsProjectViewSettings¶
- class qgis.core.QgsProjectViewSettings¶
Bases:
PyQt5.QtCore.QObject
Contains settings and properties relating to how a
QgsProject
should be displayed inside map canvas, e.g. map scales and default view extent for the project.New in version 3.10.1.
QgsProjectViewSettings(project:
QgsProject
= None) Constructor forQgsProjectViewSettings
for the specifiedproject
.Ownership is transferred to the
project
.Methods
Returns the default map rotation (in clockwise degrees) for maps in the project.
Returns the default view extent, which should be used as the initial map extent when this project is opened.
Returns the full extent of the project, which represents the maximal limits of the project.
Returns the list of custom project map scales.
Returns the project's preset full extent.
Reads the settings's state from a DOM element.
Resets the settings to a default state.
Set the default
rotation
of maps in the project, in clockwise degrees.Sets the default view
extent
, which should be used as the initial map extent when this project is opened.Sets the list of custom project map
scales
.Sets the project's preset full
extent
.Sets whether project
mapScales()
areenabled
.Returns
True
if projectmapScales()
are enabled.Returns a DOM element representing the settings.
Signals
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
pyqtSignal(*types, name: str = ..., revision: int = ..., arguments: Sequence = ...) -> PYQT_SIGNAL
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- defaultRotation(self) float ¶
Returns the default map rotation (in clockwise degrees) for maps in the project.
Warning
When a project is opened in the QGIS desktop application and saved, individual map canvases will store their own previous map rotations as custom project properties. Reloading this saved version of the project will trigger the canvases to restore their individual rotations. Accordingly, in the QGIS desktop application, this setting only forms a default, initial view used when the project is opened for the very first time (or when new map canvases are opened in that project.)
See also
New in version 3.22.12.
- Return type:
float
- defaultViewExtent(self) QgsReferencedRectangle ¶
Returns the default view extent, which should be used as the initial map extent when this project is opened.
Warning
When a project is opened in the QGIS desktop application and saved, individual map canvases will store their own previous view extent as custom project properties. Reloading this saved version of the project will trigger the canvases to restore their individual last view extents. Accordingly, in the QGIS desktop application, this setting only forms a default, initial view used when the project is opened for the very first time.
See also
- Return type:
- disconnectNotify(self, QMetaMethod)¶
- fullExtent(self) QgsReferencedRectangle ¶
Returns the full extent of the project, which represents the maximal limits of the project.
The returned extent will be in the project’s CRS.
If the
presetFullExtent()
is non null, this will be returned as the full extent. Otherwise the full extent will be calculated based on the extent of all layers in the project.See also
See also
- Return type:
- isSignalConnected(self, QMetaMethod) bool ¶
- mapScales(self) List[float] ¶
Returns the list of custom project map scales.
The scales list consists of a list of scale denominator values, e.g. 1000 for a 1:1000 scale.
See also
See also
- Return type:
List[float]
- mapScalesChanged¶
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
- presetFullExtent(self) QgsReferencedRectangle ¶
Returns the project’s preset full extent.
This extent represents the maximal limits of the project. The full extent defaults to a null rectangle, which indicates that the maximal extent should be calculated based on the layers in the project.
See also
See also
New in version 3.18.
- Return type:
- presetFullExtentChanged¶
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
- readXml(self, element: QDomElement, context: QgsReadWriteContext) bool ¶
Reads the settings’s state from a DOM element.
See also
- Parameters:
element (QDomElement) –
context (QgsReadWriteContext) –
- Return type:
bool
- receivers(self, PYQT_SIGNAL) int ¶
- reset(self)¶
Resets the settings to a default state.
- sender(self) QObject ¶
- senderSignalIndex(self) int ¶
- setDefaultRotation(self, rotation: float)¶
Set the default
rotation
of maps in the project, in clockwise degrees.Warning
When a project is opened in the QGIS desktop application and saved, individual map canvases will store their own previous map rotations as custom project properties. Reloading this saved version of the project will trigger the canvases to restore their individual rotations. Accordingly, in the QGIS desktop application, this setting only forms a default, initial view used when the project is opened for the very first time (or when new map canvases are opened in that project.)
See also
New in version 3.22.12.
- Parameters:
rotation (float) –
- setDefaultViewExtent(self, extent: QgsReferencedRectangle)¶
Sets the default view
extent
, which should be used as the initial map extent when this project is opened.Warning
When a project is opened in the QGIS desktop application and saved, individual map canvases will store their own previous view extent as custom project properties. Reloading this saved version of the project will trigger the canvases to restore their individual last view extents. Accordingly, in the QGIS desktop application, this setting only forms a default, initial view used when the project is opened for the very first time.
See also
- Parameters:
extent (QgsReferencedRectangle) –
- setMapScales(self, scales: Iterable[float])¶
Sets the list of custom project map
scales
.The
scales
list consists of a list of scale denominator values, e.g. 1000 for a 1:1000 scale.See also
See also
- Parameters:
scales (Iterable[float]) –
- setPresetFullExtent(self, extent: QgsReferencedRectangle)¶
Sets the project’s preset full
extent
.This extent represents the maximal limits of the project. Setting the full
extent
to a null rectangle indicates that the maximal extent should be calculated based on the layers in the project.See also
See also
New in version 3.18.
- Parameters:
extent (QgsReferencedRectangle) –
- setUseProjectScales(self, enabled: bool)¶
Sets whether project
mapScales()
areenabled
.When project map scales are enabled these scales will replace the default QGIS map scales list while working with this project.
See also
See also
- Parameters:
enabled (bool) –
- timerEvent(self, QTimerEvent)¶
- useProjectScales(self) bool ¶
Returns
True
if projectmapScales()
are enabled.When project map scales are enabled these scales will replace the default QGIS map scales list while working with this project.
See also
See also
- Return type:
bool
- writeXml(self, doc: QDomDocument, context: QgsReadWriteContext) QDomElement ¶
Returns a DOM element representing the settings.
See also
- Parameters:
doc (QDomDocument) –
context (QgsReadWriteContext) –
- Return type:
QDomElement