Skip to content

Class QfMultiFeatureListModel

ClassList > QfMultiFeatureListModel

Inherits the following classes: QSortFilterProxyModel

Public Types

Type Name
enum FeatureListRoles

Public Properties

Type Name
property bool canDeleteSelection
property bool canDuplicateSelection
property bool canEditAttributesSelection
property bool canMergeSelection
property bool canMoveSelection
property bool canProcessSelection
property bool canRotateSelection
property int count
property int selectedCount
property QList< QgsFeature > selectedFeatures
property QgsVectorLayer * selectedLayer

Public Signals

Type Name
signal void countChanged
signal void selectedCountChanged
signal void selectedLayerChanged

Public Functions

Type Name
QfMultiFeatureListModel (QObject * parent=nullptr)
void appendFeatures (const QList< QfIdentifyTool::IdentifyResult > & results)
bool canDeleteSelection () const
Returns TRUE if the selected features can be deleted.
bool canDuplicateSelection () const
Returns TRUE if the selected features can be duplicated onto their associated layer.
bool canEditAttributesSelection () const
Returns TRUE if the selected features can have their attributes value changed.
bool canMergeSelection () const
Returns TRUE if the selected features can be merged.
bool canMoveSelection () const
Returns TRUE if the selected features' geometry can be moved.
bool canProcessSelection () const
Returns TRUE if the selected features can run processing algorithms.
bool canRotateSelection () const
Returns TRUE if the selected features' geometry can be rotated.
Q_INVOKABLE void clear (const bool keepSelected=false)
Q_INVOKABLE void clearSelection ()
int count () const
Q_INVOKABLE bool deleteFeature (QgsVectorLayer * layer, QgsFeatureId fid)
Q_INVOKABLE bool deleteSelection ()
Deletes selected features.
Q_INVOKABLE bool duplicateFeature (QgsVectorLayer * layer, const QgsFeature & feature)
Q_INVOKABLE bool duplicateSelection ()
Duplicates selected features onto their associated layer.
Q_INVOKABLE bool mergeSelection ()
Q_INVOKABLE bool moveSelection (const double x, const double y, const QgsPoint & destinationPoint)
Q_INVOKABLE bool rotateSelection (const double angle)
Rotate selected features along a given vector .
int selectedCount () const
QList< QgsFeature > selectedFeatures ()
QgsVectorLayer * selectedLayer ()
void setFeatures (const QMap< QgsVectorLayer *, QgsFeatureRequest > & requests)
Q_INVOKABLE void setFeatures (QgsVectorLayer * vl, const QString & filter, const QgsRectangle & extent=QgsRectangle())
Q_INVOKABLE void toggleSelectedItem (int item)

Protected Functions

Type Name
void adjustFilterToSelectedCount ()
virtual bool filterAcceptsRow (int source_row, const QModelIndex & source_parent) override const

Public Types Documentation

enum FeatureListRoles

enum QfMultiFeatureListModel::FeatureListRoles {
    FeatureIdRole = Qt::UserRole + 1,
    FeatureSelectedRole,
    FeatureNameRole,
    FeatureRole,
    LayerNameRole,
    LayerRole,
    GeometryRole,
    CrsRole,
    DeleteFeatureRole,
    EditGeometryRole,
    ConditionalTextColorRole,
    ConditionalBackgroundColorRole,
    ConditionalFontBoldRole,
    ConditionalFontItalicRole,
    ConditionalFontUnderlineRole,
    ConditionalFontStrikeOutRole,
    ExtrusionRole
};

Public Properties Documentation

property canDeleteSelection [1/2]

bool QfMultiFeatureListModel::canDeleteSelection;

property canDuplicateSelection [1/2]

bool QfMultiFeatureListModel::canDuplicateSelection;

property canEditAttributesSelection [1/2]

bool QfMultiFeatureListModel::canEditAttributesSelection;

property canMergeSelection [1/2]

bool QfMultiFeatureListModel::canMergeSelection;

property canMoveSelection [1/2]

bool QfMultiFeatureListModel::canMoveSelection;

property canProcessSelection [1/2]

bool QfMultiFeatureListModel::canProcessSelection;

property canRotateSelection [1/2]

bool QfMultiFeatureListModel::canRotateSelection;

property count [1/2]

int QfMultiFeatureListModel::count;

property selectedCount [1/2]

int QfMultiFeatureListModel::selectedCount;

property selectedFeatures [1/2]

QList< QgsFeature > QfMultiFeatureListModel::selectedFeatures;

property selectedLayer [1/2]

QgsVectorLayer * QfMultiFeatureListModel::selectedLayer;

Public Signals Documentation

signal countChanged

void QfMultiFeatureListModel::countChanged;

signal selectedCountChanged

void QfMultiFeatureListModel::selectedCountChanged;

signal selectedLayerChanged

void QfMultiFeatureListModel::selectedLayerChanged;

Public Functions Documentation

function QfMultiFeatureListModel

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

function appendFeatures

void QfMultiFeatureListModel::appendFeatures (
    const QList< QfIdentifyTool::IdentifyResult > & results
) 

Appends features from a list of results.


function canDeleteSelection [2/2]

Returns TRUE if the selected features can be deleted.

bool QfMultiFeatureListModel::canDeleteSelection () const


function canDuplicateSelection [2/2]

Returns TRUE if the selected features can be duplicated onto their associated layer.

bool QfMultiFeatureListModel::canDuplicateSelection () const


function canEditAttributesSelection [2/2]

Returns TRUE if the selected features can have their attributes value changed.

bool QfMultiFeatureListModel::canEditAttributesSelection () const


function canMergeSelection [2/2]

Returns TRUE if the selected features can be merged.

bool QfMultiFeatureListModel::canMergeSelection () const


function canMoveSelection [2/2]

Returns TRUE if the selected features' geometry can be moved.

bool QfMultiFeatureListModel::canMoveSelection () const


function canProcessSelection [2/2]

Returns TRUE if the selected features can run processing algorithms.

bool QfMultiFeatureListModel::canProcessSelection () const


function canRotateSelection [2/2]

Returns TRUE if the selected features' geometry can be rotated.

bool QfMultiFeatureListModel::canRotateSelection () const


function clear

Q_INVOKABLE void QfMultiFeatureListModel::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

Q_INVOKABLE void QfMultiFeatureListModel::clearSelection () 

Empties the list of selected features.


function count [2/2]

int QfMultiFeatureListModel::count () const

Returns the number of features in the model.


function deleteFeature

Q_INVOKABLE bool QfMultiFeatureListModel::deleteFeature (
    QgsVectorLayer * layer,
    QgsFeatureId fid
) 

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

function deleteSelection

Deletes selected features.

Q_INVOKABLE bool QfMultiFeatureListModel::deleteSelection () 


function duplicateFeature

Q_INVOKABLE bool QfMultiFeatureListModel::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.

Q_INVOKABLE bool QfMultiFeatureListModel::duplicateSelection () 


function mergeSelection

Q_INVOKABLE bool QfMultiFeatureListModel::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

Q_INVOKABLE bool QfMultiFeatureListModel::moveSelection (
    const double x,
    const double y,
    const QgsPoint & destinationPoint
) 

Moves selected feature(s) geometry by x and y. For a single feature with a singlepart point geometry containing Z and/or M values will adopt non-null values from the destinationPoint.


function rotateSelection

Rotate selected features along a given vector .

Q_INVOKABLE bool QfMultiFeatureListModel::rotateSelection (
    const double angle
) 


function selectedCount [2/2]

int QfMultiFeatureListModel::selectedCount () const

Returns the number of selected features in the model.


function selectedFeatures [2/2]

QList< QgsFeature > QfMultiFeatureListModel::selectedFeatures () 

Returns the list of currently selected features.


function selectedLayer [2/2]

QgsVectorLayer * QfMultiFeatureListModel::selectedLayer () 

Returns the vector layer within which one or more features are currently selected


function setFeatures [1/2]

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

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


function setFeatures [2/2]

Q_INVOKABLE void QfMultiFeatureListModel::setFeatures (
    QgsVectorLayer * vl,
    const QString & filter,
    const QgsRectangle & extent=QgsRectangle()
) 

Resets the model to contain features found from a vl with the possibility of filtering by a filter expression and/or an extent.


function toggleSelectedItem

Q_INVOKABLE void QfMultiFeatureListModel::toggleSelectedItem (
    int item
) 

Toggles the selection state of a given item.

Parameters:

  • item the item's row number

Protected Functions Documentation

function adjustFilterToSelectedCount

void QfMultiFeatureListModel::adjustFilterToSelectedCount () 

function filterAcceptsRow

virtual bool QfMultiFeatureListModel::filterAcceptsRow (
    int source_row,
    const QModelIndex & source_parent
) override const


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