Class MultiFeatureListModel
ClassList > MultiFeatureListModel
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 |
|---|---|
| MultiFeatureListModel (QObject * parent=nullptr) |
|
| void | appendFeatures (const QList< IdentifyTool::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 MultiFeatureListModel::FeatureListRoles {
FeatureIdRole = Qt::UserRole + 1,
FeatureSelectedRole,
FeatureNameRole,
FeatureRole,
LayerNameRole,
LayerRole,
GeometryRole,
CrsRole,
DeleteFeatureRole,
EditGeometryRole
};
Public Properties Documentation
property canDeleteSelection [1/2]
bool MultiFeatureListModel::canDeleteSelection;
property canDuplicateSelection [1/2]
bool MultiFeatureListModel::canDuplicateSelection;
property canEditAttributesSelection [1/2]
bool MultiFeatureListModel::canEditAttributesSelection;
property canMergeSelection [1/2]
bool MultiFeatureListModel::canMergeSelection;
property canMoveSelection [1/2]
bool MultiFeatureListModel::canMoveSelection;
property canProcessSelection [1/2]
bool MultiFeatureListModel::canProcessSelection;
property canRotateSelection [1/2]
bool MultiFeatureListModel::canRotateSelection;
property count [1/2]
int MultiFeatureListModel::count;
property selectedCount [1/2]
int MultiFeatureListModel::selectedCount;
property selectedFeatures [1/2]
QList< QgsFeature > MultiFeatureListModel::selectedFeatures;
property selectedLayer [1/2]
QgsVectorLayer * MultiFeatureListModel::selectedLayer;
Public Signals Documentation
signal countChanged
void MultiFeatureListModel::countChanged;
signal selectedCountChanged
void MultiFeatureListModel::selectedCountChanged;
signal selectedLayerChanged
void MultiFeatureListModel::selectedLayerChanged;
Public Functions Documentation
function MultiFeatureListModel
explicit MultiFeatureListModel::MultiFeatureListModel (
QObject * parent=nullptr
)
function appendFeatures
void MultiFeatureListModel::appendFeatures (
const QList< IdentifyTool::IdentifyResult > & results
)
Appends features from a list of results.
function canDeleteSelection [2/2]
Returns TRUE if the selected features can be deleted.
bool MultiFeatureListModel::canDeleteSelection () const
function canDuplicateSelection [2/2]
Returns TRUE if the selected features can be duplicated onto their associated layer.
bool MultiFeatureListModel::canDuplicateSelection () const
function canEditAttributesSelection [2/2]
Returns TRUE if the selected features can have their attributes value changed.
bool MultiFeatureListModel::canEditAttributesSelection () const
function canMergeSelection [2/2]
Returns TRUE if the selected features can be merged.
bool MultiFeatureListModel::canMergeSelection () const
function canMoveSelection [2/2]
Returns TRUE if the selected features' geometry can be moved.
bool MultiFeatureListModel::canMoveSelection () const
function canProcessSelection [2/2]
Returns TRUE if the selected features can run processing algorithms.
bool MultiFeatureListModel::canProcessSelection () const
function canRotateSelection [2/2]
Returns TRUE if the selected features' geometry can be rotated.
bool MultiFeatureListModel::canRotateSelection () const
function clear
Q_INVOKABLE void MultiFeatureListModel::clear (
const bool keepSelected=false
)
Resets the model to either an empty feature list or one that contains only the selected features.
Parameters:
keepSelectedif set to TRUE, selected features will be kept when resetting the model.
function clearSelection
Q_INVOKABLE void MultiFeatureListModel::clearSelection ()
Empties the list of selected features.
function count [2/2]
int MultiFeatureListModel::count () const
Returns the number of features in the model.
function deleteFeature
Q_INVOKABLE bool MultiFeatureListModel::deleteFeature (
QgsVectorLayer * layer,
QgsFeatureId fid
)
Deletes a feature from a vector layer
Parameters:
layerThe layer from which a feature will be removedfidThe id of the feature to remove
function deleteSelection
Deletes selected features.
Q_INVOKABLE bool MultiFeatureListModel::deleteSelection ()
function duplicateFeature
Q_INVOKABLE bool MultiFeatureListModel::duplicateFeature (
QgsVectorLayer * layer,
const QgsFeature & feature
)
Duplicates a feature on a given layer
Parameters:
layerThe layer within which the feature will be duplicatedfeatureThe feature to be duplicated
function duplicateSelection
Duplicates selected features onto their associated layer.
Q_INVOKABLE bool MultiFeatureListModel::duplicateSelection ()
function mergeSelection
Q_INVOKABLE bool MultiFeatureListModel::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 MultiFeatureListModel::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 MultiFeatureListModel::rotateSelection (
const double angle
)
function selectedCount [2/2]
int MultiFeatureListModel::selectedCount () const
Returns the number of selected features in the model.
function selectedFeatures [2/2]
QList< QgsFeature > MultiFeatureListModel::selectedFeatures ()
Returns the list of currently selected features.
function selectedLayer [2/2]
QgsVectorLayer * MultiFeatureListModel::selectedLayer ()
Returns the vector layer within which one or more features are currently selected
function setFeatures [1/2]
void MultiFeatureListModel::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 MultiFeatureListModel::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 MultiFeatureListModel::toggleSelectedItem (
int item
)
Toggles the selection state of a given item.
Parameters:
itemthe item's row number
Protected Functions Documentation
function adjustFilterToSelectedCount
void MultiFeatureListModel::adjustFilterToSelectedCount ()
function filterAcceptsRow
virtual bool MultiFeatureListModel::filterAcceptsRow (
int source_row,
const QModelIndex & source_parent
) override const
The documentation for this class was generated from the following file src/core/multifeaturelistmodel.h