QGIS API Documentation  3.16.0-Hannover (43b64b13f3)
Signals | Public Member Functions | List of all members
QgsProjectViewSettings Class Reference

Contains settings and properties relating to how a QgsProject should be displayed inside map canvas, e.g. More...

#include <qgsprojectviewsettings.h>

Inheritance diagram for QgsProjectViewSettings:
Inheritance graph
[legend]

Signals

void mapScalesChanged ()
 Emitted when the list of custom project map scales changes. More...
 

Public Member Functions

 QgsProjectViewSettings (QObject *parent=nullptr)
 Constructor for QgsProjectViewSettings with the specified parent object. More...
 
QgsReferencedRectangle defaultViewExtent () const
 Returns the default view extent, which should be used as the initial map extent when this project is opened. More...
 
QVector< double > mapScales () const
 Returns the list of custom project map scales. More...
 
bool readXml (const QDomElement &element, const QgsReadWriteContext &context)
 Reads the settings's state from a DOM element. More...
 
void reset ()
 Resets the settings to a default state. More...
 
void setDefaultViewExtent (const QgsReferencedRectangle &extent)
 Sets the default view extent, which should be used as the initial map extent when this project is opened. More...
 
void setMapScales (const QVector< double > &scales)
 Sets the list of custom project map scales. More...
 
void setUseProjectScales (bool enabled)
 Sets whether project mapScales() are enabled. More...
 
bool useProjectScales () const
 Returns true if project mapScales() are enabled. More...
 
QDomElement writeXml (QDomDocument &doc, const QgsReadWriteContext &context) const
 Returns a DOM element representing the settings. More...
 

Detailed Description

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.

Since
QGIS 3.10.1

Definition at line 34 of file qgsprojectviewsettings.h.

Constructor & Destructor Documentation

◆ QgsProjectViewSettings()

QgsProjectViewSettings::QgsProjectViewSettings ( QObject *  parent = nullptr)

Constructor for QgsProjectViewSettings with the specified parent object.

Definition at line 20 of file qgsprojectviewsettings.cpp.

Member Function Documentation

◆ defaultViewExtent()

QgsReferencedRectangle QgsProjectViewSettings::defaultViewExtent ( ) const

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
setDefaultViewExtent()

Definition at line 37 of file qgsprojectviewsettings.cpp.

◆ mapScales()

QVector< double > QgsProjectViewSettings::mapScales ( ) const

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
setMapScales()
mapScalesChanged()

Definition at line 61 of file qgsprojectviewsettings.cpp.

◆ mapScalesChanged

void QgsProjectViewSettings::mapScalesChanged ( )
signal

Emitted when the list of custom project map scales changes.

See also
mapScales()
setMapScales()

◆ readXml()

bool QgsProjectViewSettings::readXml ( const QDomElement &  element,
const QgsReadWriteContext context 
)

Reads the settings's state from a DOM element.

See also
writeXml()

Definition at line 80 of file qgsprojectviewsettings.cpp.

◆ reset()

void QgsProjectViewSettings::reset ( )

Resets the settings to a default state.

Definition at line 26 of file qgsprojectviewsettings.cpp.

◆ setDefaultViewExtent()

void QgsProjectViewSettings::setDefaultViewExtent ( const QgsReferencedRectangle extent)

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
defaultViewExtent()

Definition at line 42 of file qgsprojectviewsettings.cpp.

◆ setMapScales()

void QgsProjectViewSettings::setMapScales ( const QVector< double > &  scales)

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
mapScales()
mapScalesChanged()

Definition at line 47 of file qgsprojectviewsettings.cpp.

◆ setUseProjectScales()

void QgsProjectViewSettings::setUseProjectScales ( bool  enabled)

Sets whether project mapScales() 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
useProjectScales()
setMapScales()

Definition at line 66 of file qgsprojectviewsettings.cpp.

◆ useProjectScales()

bool QgsProjectViewSettings::useProjectScales ( ) const

Returns true if project mapScales() 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
setUseProjectScales()
mapScales()

Definition at line 75 of file qgsprojectviewsettings.cpp.

◆ writeXml()

QDomElement QgsProjectViewSettings::writeXml ( QDomDocument &  doc,
const QgsReadWriteContext context 
) const

Returns a DOM element representing the settings.

See also
readXml()

Definition at line 122 of file qgsprojectviewsettings.cpp.


The documentation for this class was generated from the following files: