Skip to content

Class ProjectInfo

ClassList > ProjectInfo

More...

  • #include <projectinfo.h>

Inherits the following classes: QObject

Public Properties

Type Name
property QgsMapLayer * activeLayer
property CloudUserInformation cloudUserInformation
property QString filePath
property FlatLayerTreeModel * layerTree
property QgsQuickMapSettings * mapSettings
property bool snappingEnabled
property QString stateMode
property TrackingModel * trackingModel

Public Signals

Type Name
signal void activeLayerChanged
signal void cloudUserInformationChanged
signal void filePathChanged
signal void layerTreeChanged
signal void mapSettingsChanged
signal void snappingEnabledChanged
signal void stateModeChanged
signal void trackingModelChanged

Public Functions

Type Name
ProjectInfo (QObject * parent=nullptr)
QgsMapLayer * activeLayer () const
CloudUserInformation cloudUserInformation () const
QString filePath () const
Q_INVOKABLE QVariantMap getCopyrightDecorationConfiguration ()
Retrieves configuration of the copyright decoration.
Q_INVOKABLE QgsMapLayer * getDefaultActiveLayerForMapTheme (const QString & mapTheme)
Retrieves the default active layer for a given map theme.
Q_INVOKABLE QVariantMap getGridDecorationConfiguration ()
Retrieves configuration of the grid decoration.
Q_INVOKABLE QVariantMap getImageDecorationConfiguration ()
Retrieves configuration of the image decoration.
Q_INVOKABLE QVariantMap getTitleDecorationConfiguration ()
Retrieves configuration of the title decoration.
FlatLayerTreeModel * layerTree () const
QgsQuickMapSettings * mapSettings () const
Q_INVOKABLE void restoreCloudUserInformation ()
Q_INVOKABLE QModelIndex restoreTracker (QgsVectorLayer * layer)
Restore the last tracking session that occured within a vector layer .
Q_INVOKABLE void saveLayerRememberedFields (QgsMapLayer * layer)
Q_INVOKABLE void saveLayerSnappingConfiguration (QgsMapLayer * layer)
Q_INVOKABLE void saveLayerStyle (QgsMapLayer * layer)
Q_INVOKABLE void saveLayerTreeState ()
Q_INVOKABLE void saveTracker (QgsVectorLayer * layer)
Save an ongoing vector layer tracking session details.
Q_INVOKABLE void saveVariable (const QString & name, const QString & value)
void setActiveLayer (QgsMapLayer * layer)
void setCloudUserInformation (const CloudUserInformation cloudUserInformation)
void setFilePath (const QString & filePath)
void setLayerTree (FlatLayerTreeModel * layerTree)
void setMapSettings (QgsQuickMapSettings * mapSettings)
void setSnappingEnabled (bool enabled)
void setStateMode (const QString & mode)
void setTrackingModel (TrackingModel * trackingModel)
bool snappingEnabled () const
QString stateMode () const
TrackingModel * trackingModel () const
virtual ~ProjectInfo () = default

Public Static Functions

Type Name
void restoreSettings (QString & projectFilePath, QgsProject * project, QgsQuickMapCanvasMap * mapCanvas, FlatLayerTreeModel * layerTree)
Restore various project settings.

Detailed Description

This class stores current projection information such as extent and map theme in order for those to be saved and afterwards restored when the project is re-opened.

Public Properties Documentation

property activeLayer [1/2]

QgsMapLayer * ProjectInfo::activeLayer;

The active layer for the currently opened project.


property cloudUserInformation [1/2]

CloudUserInformation ProjectInfo::cloudUserInformation;

Set cloud user information for offline usage.


property filePath [1/2]

QString ProjectInfo::filePath;

The file path associated with the currently opened project.


property layerTree [1/2]

FlatLayerTreeModel * ProjectInfo::layerTree;

The layer tree model object, used to keep track of details such as layer visibility, selected map theme, etc.


property mapSettings [1/2]

QgsQuickMapSettings * ProjectInfo::mapSettings;

The map settings object, used to keep track of details such as the map extent.


property snappingEnabled [1/2]

bool ProjectInfo::snappingEnabled;

The snapping enabled state for the currently opened project.


property stateMode [1/2]

QString ProjectInfo::stateMode;

The state mode (browse vs. digitizing) for the currently opened project.


property trackingModel [1/2]

TrackingModel * ProjectInfo::trackingModel;

The tracking model object, used to save and restore tracking session for individual vector layers.


Public Signals Documentation

signal activeLayerChanged

void ProjectInfo::activeLayerChanged;

signal cloudUserInformationChanged

void ProjectInfo::cloudUserInformationChanged;

signal filePathChanged

void ProjectInfo::filePathChanged;

signal layerTreeChanged

void ProjectInfo::layerTreeChanged;

signal mapSettingsChanged

void ProjectInfo::mapSettingsChanged;

signal snappingEnabledChanged

void ProjectInfo::snappingEnabledChanged;

signal stateModeChanged

void ProjectInfo::stateModeChanged;

signal trackingModelChanged

void ProjectInfo::trackingModelChanged;

Public Functions Documentation

function ProjectInfo

explicit ProjectInfo::ProjectInfo (
    QObject * parent=nullptr
) 

function activeLayer [2/2]

QgsMapLayer * ProjectInfo::activeLayer () const

Returns the saved active layer for the current project or nullptr if active layer was not saved or isn't present


function cloudUserInformation [2/2]

CloudUserInformation ProjectInfo::cloudUserInformation () const

Returns the saved cloud user infomation for offline usage


function filePath [2/2]

QString ProjectInfo::filePath () const

The file path associated with the currently opened project.


function getCopyrightDecorationConfiguration

Retrieves configuration of the copyright decoration.

Q_INVOKABLE QVariantMap ProjectInfo::getCopyrightDecorationConfiguration () 

function getDefaultActiveLayerForMapTheme

Retrieves the default active layer for a given map theme.

Q_INVOKABLE QgsMapLayer * ProjectInfo::getDefaultActiveLayerForMapTheme (
    const QString & mapTheme
) 

function getGridDecorationConfiguration

Retrieves configuration of the grid decoration.

Q_INVOKABLE QVariantMap ProjectInfo::getGridDecorationConfiguration () 

function getImageDecorationConfiguration

Retrieves configuration of the image decoration.

Q_INVOKABLE QVariantMap ProjectInfo::getImageDecorationConfiguration () 

function getTitleDecorationConfiguration

Retrieves configuration of the title decoration.

Q_INVOKABLE QVariantMap ProjectInfo::getTitleDecorationConfiguration () 

function layerTree [2/2]

FlatLayerTreeModel * ProjectInfo::layerTree () const

The layer tree model object, used to keep track of details such as layer visibility, selected map theme, etc.


function mapSettings [2/2]

QgsQuickMapSettings * ProjectInfo::mapSettings () const

The map settings object, used to keep track of details such as the map extent.


function restoreCloudUserInformation

Q_INVOKABLE void ProjectInfo::restoreCloudUserInformation () 

Restores last saved cloud user information details attached to the current project


function restoreTracker

Restore the last tracking session that occured within a vector layer .

Q_INVOKABLE QModelIndex ProjectInfo::restoreTracker (
    QgsVectorLayer * layer
) 

function saveLayerRememberedFields

Q_INVOKABLE void ProjectInfo::saveLayerRememberedFields (
    QgsMapLayer * layer
) 

Saves the vector layer fields that are remembered during feature additions


function saveLayerSnappingConfiguration

Q_INVOKABLE void ProjectInfo::saveLayerSnappingConfiguration (
    QgsMapLayer * layer
) 

Saves the current snapping configuration settings


function saveLayerStyle

Q_INVOKABLE void ProjectInfo::saveLayerStyle (
    QgsMapLayer * layer
) 

Saves the layer style to the current project information settings


function saveLayerTreeState

Q_INVOKABLE void ProjectInfo::saveLayerTreeState () 

Saves the current state (visibility and collapse status) of the layer tree


function saveTracker

Save an ongoing vector layer tracking session details.

Q_INVOKABLE void ProjectInfo::saveTracker (
    QgsVectorLayer * layer
) 

function saveVariable

Q_INVOKABLE void ProjectInfo::saveVariable (
    const QString & name,
    const QString & value
) 

function setActiveLayer

void ProjectInfo::setActiveLayer (
    QgsMapLayer * layer
) 

Saves the active layer within the current project


function setCloudUserInformation

void ProjectInfo::setCloudUserInformation (
    const CloudUserInformation cloudUserInformation
) 

Saves the cloud user infomation for offline usage


function setFilePath

void ProjectInfo::setFilePath (
    const QString & filePath
) 

The file path associated with the currently opened project.


function setLayerTree

void ProjectInfo::setLayerTree (
    FlatLayerTreeModel * layerTree
) 

The layer tree model object, used to keep track of details such as layer visibility, selected map theme, etc.


function setMapSettings

void ProjectInfo::setMapSettings (
    QgsQuickMapSettings * mapSettings
) 

The map settings object, used to keep track of details such as the map extent.


function setSnappingEnabled

void ProjectInfo::setSnappingEnabled (
    bool enabled
) 

Saves the snapping enabled state for the current project


function setStateMode

void ProjectInfo::setStateMode (
    const QString & mode
) 

Saves the state mode for the current project


function setTrackingModel

void ProjectInfo::setTrackingModel (
    TrackingModel * trackingModel
) 

The tracking model object, used to save and restore tracking session for individual vector layers.


function snappingEnabled [2/2]

bool ProjectInfo::snappingEnabled () const

Returns the saved snapping enabed state for the current project


function stateMode [2/2]

QString ProjectInfo::stateMode () const

Returns the saved state mode for the current project


function trackingModel [2/2]

TrackingModel * ProjectInfo::trackingModel () const

The tracking model object, used to save and restore tracking session for individual vector layers.


function ~ProjectInfo

virtual ProjectInfo::~ProjectInfo () = default

Public Static Functions Documentation

function restoreSettings

Restore various project settings.

static void ProjectInfo::restoreSettings (
    QString & projectFilePath,
    QgsProject * project,
    QgsQuickMapCanvasMap * mapCanvas,
    FlatLayerTreeModel * layerTree
) 


The documentation for this class was generated from the following file src/core/projectinfo.h