Skip to content

Class MultiFeatureListModelBase

ClassList > MultiFeatureListModelBase

Inherits the following classes: QAbstractItemModel

Public Signals

Type Name
signal void countChanged
signal void selectedCountChanged

Public Functions

Type Name
MultiFeatureListModelBase (QObject * parent=nullptr)
void appendFeatures (const QList< IdentifyTool::IdentifyResult > & results)
bool canDeleteSelection () const
bool canDuplicateSelection () const
bool canEditAttributesSelection () const
bool canMergeSelection () const
bool canMoveSelection () const
bool canProcessSelection () const
bool canRotateSelection () const
void clear (const bool keepSelected=false)
void clearSelection ()
int columnCount (const QModelIndex & parent) override const
int count () const
QVariant data (const QModelIndex & index, int role) override const
bool deleteFeature (QgsVectorLayer * layer, QgsFeatureId fid, bool selectionAction=false)
bool deleteSelection ()
Deletes selected features.
bool duplicateFeature (QgsVectorLayer * layer, const QgsFeature & feature)
bool duplicateSelection ()
Duplicates selected features onto their associated layer.
QModelIndex index (int row, int column, const QModelIndex & parent=QModelIndex()) override const
bool mergeSelection ()
bool moveSelection (const double x, const double y)
Moves selected features along a given vector .
QModelIndex parent (const QModelIndex & child) override const
virtual bool removeRows (int row, int count, const QModelIndex & parent) override
QHash< int, QByteArray > roleNames () override const
bool rotateSelection (const double angle)
Rotate selected features along a given vector .
int rowCount (const QModelIndex & parent) override const
int selectedCount () const
QList< QgsFeature > selectedFeatures () const
QgsVectorLayer * selectedLayer () const
void setFeatures (const QMap< QgsVectorLayer *, QgsFeatureRequest > & requests)
void toggleSelectedItem (int item)

Public Signals Documentation

signal countChanged

void MultiFeatureListModelBase::countChanged;

signal selectedCountChanged

void MultiFeatureListModelBase::selectedCountChanged;

Public Functions Documentation

function MultiFeatureListModelBase

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

function appendFeatures

void MultiFeatureListModelBase::appendFeatures (
    const QList< IdentifyTool::IdentifyResult > & results
) 

Appends features from a list of results.


function canDeleteSelection

bool MultiFeatureListModelBase::canDeleteSelection () const

function canDuplicateSelection

bool MultiFeatureListModelBase::canDuplicateSelection () const

function canEditAttributesSelection

bool MultiFeatureListModelBase::canEditAttributesSelection () const

function canMergeSelection

bool MultiFeatureListModelBase::canMergeSelection () const

function canMoveSelection

bool MultiFeatureListModelBase::canMoveSelection () const

function canProcessSelection

bool MultiFeatureListModelBase::canProcessSelection () const

function canRotateSelection

bool MultiFeatureListModelBase::canRotateSelection () const

function clear

void MultiFeatureListModelBase::clear (
    const bool keepSelected=false
) 

Resets the model to either an empty feature list or one that contains only the selected features.

Parameters:

  • keepSelected if set to TRUE, selected features will be kept when resetting the model.

function clearSelection

void MultiFeatureListModelBase::clearSelection () 

Empties the list of selected features.


function columnCount

int MultiFeatureListModelBase::columnCount (
    const QModelIndex & parent
) override const

function count

int MultiFeatureListModelBase::count () const

function data

QVariant MultiFeatureListModelBase::data (
    const QModelIndex & index,
    int role
) override const

function deleteFeature

bool MultiFeatureListModelBase::deleteFeature (
    QgsVectorLayer * layer,
    QgsFeatureId fid,
    bool selectionAction=false
) 

Deletes a feature from a vector layer

Parameters:

  • layer The layer from which a feature will be removed
  • fid The id of the feature to remove
  • selectionAction

function deleteSelection

Deletes selected features.

bool MultiFeatureListModelBase::deleteSelection () 

function duplicateFeature

bool MultiFeatureListModelBase::duplicateFeature (
    QgsVectorLayer * layer,
    const QgsFeature & feature
) 

Duplicates a feature on a given layer

Parameters:

  • layer The layer within which the feature will be duplicated
  • feature The feature to be duplicated

function duplicateSelection

Duplicates selected features onto their associated layer.

bool MultiFeatureListModelBase::duplicateSelection () 

function index

QModelIndex MultiFeatureListModelBase::index (
    int row,
    int column,
    const QModelIndex & parent=QModelIndex()
) override const

function mergeSelection

bool MultiFeatureListModelBase::mergeSelection () 

Merges selected features by updating the first seleted feature's geometry to a combination (i.e. union) of geometries of all selected features.

All but the first feature will then be removed from the vector layer containing the selected features.


function moveSelection

Moves selected features along a given vector .

bool MultiFeatureListModelBase::moveSelection (
    const double x,
    const double y
) 

function parent

QModelIndex MultiFeatureListModelBase::parent (
    const QModelIndex & child
) override const

function removeRows

virtual bool MultiFeatureListModelBase::removeRows (
    int row,
    int count,
    const QModelIndex & parent
) override

Removes a defined number of rows starting from a given position. The parent index is not used as we have a list only.

Parameters:

  • row The first row to remove
  • count The numbe rof rows to remove
  • parent Can savely be omitted as it is unused and defaults to an invalid index

function roleNames

QHash< int, QByteArray > MultiFeatureListModelBase::roleNames () override const

function rotateSelection

Rotate selected features along a given vector .

bool MultiFeatureListModelBase::rotateSelection (
    const double angle
) 

function rowCount

int MultiFeatureListModelBase::rowCount (
    const QModelIndex & parent
) override const

function selectedCount

int MultiFeatureListModelBase::selectedCount () const

function selectedFeatures

QList< QgsFeature > MultiFeatureListModelBase::selectedFeatures () const

function selectedLayer

QgsVectorLayer * MultiFeatureListModelBase::selectedLayer () const

function setFeatures

void MultiFeatureListModelBase::setFeatures (
    const QMap< QgsVectorLayer *, QgsFeatureRequest > & requests
) 

Resets the model to contain features found from a list of requests.


function toggleSelectedItem

void MultiFeatureListModelBase::toggleSelectedItem (
    int item
) 

Toggles the selection state of a given item.

Parameters:

  • item the item's row number


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