Class: QgsProjectViewSettings¶
- class qgis.core.QgsProjectViewSettings(parent: QObject = None)¶
Bases:
PyQt5.QtCore.QObject
Constructor for
QgsProjectViewSettings
with the specifiedparent
object.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:
Methods
Returns the default view extent, which should be used as the initial map extent when this project is opened.
Returns the list of custom project map scales.
Reads the settings's state from a DOM element.
Resets the settings to a default state.
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 whether project
mapScales()
areenabled
.Returns
True
if projectmapScales()
are enabled.Returns a DOM element representing the settings.
Signals
Emitted when the list of custom project map scales changes.
- childEvent(self, QChildEvent)¶
- connectNotify(self, QMetaMethod)¶
- customEvent(self, QEvent)¶
- 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)¶
- 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¶
Emitted when the list of custom project map scales changes.
See also
See also
setMapScales()
[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 ¶
- 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]) –
- 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