QGIS API Documentation 3.37.0-Master (fdefdf9c27f)
Public Member Functions | List of all members
QgsTrackedVectorLayerTools Class Reference

#include <qgstrackedvectorlayertools.h>

Inheritance diagram for QgsTrackedVectorLayerTools:
Inheritance graph
[legend]

Public Member Functions

 QgsTrackedVectorLayerTools ()=default
 Constructor for QgsTrackedVectorLayerTools. More...
 
bool addFeature (QgsVectorLayer *layer, const QgsAttributeMap &defaultValues, const QgsGeometry &defaultGeometry, QgsFeature *feature, QWidget *parentWidget=nullptr, bool showModal=true, bool hideParent=false) const override
 This method calls the addFeature method of the backend QgsVectorLayerTools. More...
 
bool copyMoveFeatures (QgsVectorLayer *layer, QgsFeatureRequest &request, double dx=0, double dy=0, QString *errorMsg=nullptr, const bool topologicalEditing=false, QgsVectorLayer *topologicalLayer=nullptr, QString *childrenInfoMsg=nullptr) const override
 Copy and move features with defined translation. More...
 
void rollback ()
 Delete all features which have been added via this object. More...
 
bool saveEdits (QgsVectorLayer *layer) const override
 Should be called, when the features should be committed but the editing session is not ended. More...
 
void setVectorLayerTools (const QgsVectorLayerTools *tools)
 Set the vector layer tools that will be used to interact with the data. More...
 
bool startEditing (QgsVectorLayer *layer) const override
 This will be called, whenever a vector layer should be switched to edit mode. More...
 
bool stopEditing (QgsVectorLayer *layer, bool allowCancel) const override
 Will be called, when an editing session is ended and the features should be committed. More...
 
- Public Member Functions inherited from QgsVectorLayerTools
 QgsVectorLayerTools ()
 
virtual bool addFeature (QgsVectorLayer *layer, const QgsAttributeMap &defaultValues=QgsAttributeMap(), const QgsGeometry &defaultGeometry=QgsGeometry(), QgsFeature *feature=nullptr, QWidget *parentWidget=nullptr, bool showModal=true, bool hideParent=false) const =0
 This method should/will be called, whenever a new feature will be added to the layer. More...
 
virtual bool copyMoveFeatures (QgsVectorLayer *layer, QgsFeatureRequest &request, double dx=0, double dy=0, QString *errorMsg=nullptr, const bool topologicalEditing=false, QgsVectorLayer *topologicalLayer=nullptr, QString *childrenInfoMsg=nullptr) const
 Copy and move features with defined translation. More...
 
bool forceSuppressFormPopup () const
 Returns force suppress form popup status. More...
 
QgsProjectproject () const
 Returns the project to be used by operations when needed. More...
 
virtual bool saveEdits (QgsVectorLayer *layer) const =0
 Should be called, when the features should be committed but the editing session is not ended. More...
 
void setForceSuppressFormPopup (bool forceSuppressFormPopup)
 Sets force suppress form popup status to forceSuppressFormPopup. More...
 
void setProject (QgsProject *project)
 Sets the project to be used by operations when needed. More...
 
virtual bool startEditing (QgsVectorLayer *layer) const =0
 This will be called, whenever a vector layer should be switched to edit mode. More...
 
virtual bool stopEditing (QgsVectorLayer *layer, bool allowCancel=true) const =0
 Will be called, when an editing session is ended and the features should be committed. More...
 

Detailed Description

Definition at line 26 of file qgstrackedvectorlayertools.h.

Constructor & Destructor Documentation

◆ QgsTrackedVectorLayerTools()

QgsTrackedVectorLayerTools::QgsTrackedVectorLayerTools ( )
default

Constructor for QgsTrackedVectorLayerTools.

Member Function Documentation

◆ addFeature()

bool QgsTrackedVectorLayerTools::addFeature ( QgsVectorLayer layer,
const QgsAttributeMap defaultValues,
const QgsGeometry defaultGeometry,
QgsFeature feature,
QWidget *  parentWidget = nullptr,
bool  showModal = true,
bool  hideParent = false 
) const
overridevirtual

This method calls the addFeature method of the backend QgsVectorLayerTools.

Parameters
layerThe layer to which the feature should be added
defaultValuesDefault values for the feature to add
defaultGeometryA default geometry to add to the feature
featureA pointer to the feature
parentWidgetThe widget calling this function to be passed to the used dialog
showModalIf the used dialog should be modal or not
hideParentIf the parent widget should be hidden, when the used dialog is opened
Returns
true in case of success, false if the operation failed/was aborted

Implements QgsVectorLayerTools.

Definition at line 20 of file qgstrackedvectorlayertools.cpp.

◆ copyMoveFeatures()

bool QgsTrackedVectorLayerTools::copyMoveFeatures ( QgsVectorLayer layer,
QgsFeatureRequest request,
double  dx = 0,
double  dy = 0,
QString *  errorMsg = nullptr,
const bool  topologicalEditing = false,
QgsVectorLayer topologicalLayer = nullptr,
QString *  childrenInfoMsg = nullptr 
) const
overridevirtual

Copy and move features with defined translation.

Parameters
layerThe layer
requestThe request for the features to be moved. It will be assigned to a new feature request with the newly copied features.
dxThe translation on x
dyThe translation on y
errorMsgIf given, it will contain the error message
topologicalEditingIf true, the function will perform topological editing of the vertices of layer on layer and topologicalLayer
topologicalLayerThe layer where vertices from the moved features of layer will be added
childrenInfoMsgIf given, it will contain messages related to the creation of child features
Returns
true if all features could be copied.

Reimplemented from QgsVectorLayerTools.

Definition at line 58 of file qgstrackedvectorlayertools.cpp.

◆ rollback()

void QgsTrackedVectorLayerTools::rollback ( )

Delete all features which have been added via this object.

Definition at line 68 of file qgstrackedvectorlayertools.cpp.

◆ saveEdits()

bool QgsTrackedVectorLayerTools::saveEdits ( QgsVectorLayer layer) const
overridevirtual

Should be called, when the features should be committed but the editing session is not ended.

Parameters
layerThe layer to commit
Returns
true if successful

Implements QgsVectorLayerTools.

Definition at line 53 of file qgstrackedvectorlayertools.cpp.

◆ setVectorLayerTools()

void QgsTrackedVectorLayerTools::setVectorLayerTools ( const QgsVectorLayerTools tools)

Set the vector layer tools that will be used to interact with the data.

Definition at line 63 of file qgstrackedvectorlayertools.cpp.

◆ startEditing()

bool QgsTrackedVectorLayerTools::startEditing ( QgsVectorLayer layer) const
overridevirtual

This will be called, whenever a vector layer should be switched to edit mode.

Check the providers capability to edit in here. If successful layer->startEditing() will be called and true returned.

Parameters
layerThe layer on which to start an edit session
Returns
true, if the editing session was started

Implements QgsVectorLayerTools.

Definition at line 43 of file qgstrackedvectorlayertools.cpp.

◆ stopEditing()

bool QgsTrackedVectorLayerTools::stopEditing ( QgsVectorLayer layer,
bool  allowCancel 
) const
overridevirtual

Will be called, when an editing session is ended and the features should be committed.

Appropriate dialogs should be shown like

Parameters
layerThe layer to commit
allowCanceltrue if a cancel button should be offered
Returns
true if successful

Implements QgsVectorLayerTools.

Definition at line 48 of file qgstrackedvectorlayertools.cpp.


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