QGIS API Documentation
4.3.0-Master (16eddb2670e)
Toggle main menu visibility
Loading...
Searching...
No Matches
src
gui
attributetable
qgsfeatureselectionmodel.h
Go to the documentation of this file.
1
/***************************************************************************
2
qgsfeatureselectionmodel.h
3
---------------------
4
begin : April 2013
5
copyright : (C) 2013 by Matthias Kuhn
6
email : matthias at opengis dot ch
7
***************************************************************************
8
* *
9
* This program is free software; you can redistribute it and/or modify *
10
* it under the terms of the GNU General Public License as published by *
11
* the Free Software Foundation; either version 2 of the License, or *
12
* (at your option) any later version. *
13
* *
14
***************************************************************************/
15
#ifndef QGSFEATURESELECTIONMODEL_H
16
#define QGSFEATURESELECTIONMODEL_H
17
18
#include "qgis_gui.h"
19
#include "
qgsfeatureid.h
"
20
21
#include <QItemSelectionModel>
22
23
class
QgsVectorLayer
;
24
class
QgsFeatureModel
;
25
class
QgsIFeatureSelectionManager
;
26
32
class
GUI_EXPORT
QgsFeatureSelectionModel
:
public
QItemSelectionModel
33
{
34
Q_OBJECT
35
public
:
36
explicit
QgsFeatureSelectionModel
( QAbstractItemModel *model,
QgsFeatureModel
*featureModel,
QgsIFeatureSelectionManager
*featureSelectionHandler, QObject *parent
SIP_TRANSFERTHIS
);
37
47
void
enableSync
(
bool
enable );
48
56
57
virtual
bool
isSelected
(
QgsFeatureId
fid );
58
66
virtual
bool
isSelected
(
const
QModelIndex &index );
67
68
signals:
69
76
void
requestRepaint
(
const
QModelIndexList &indexes );
77
82
void
requestRepaint
();
83
84
public
slots:
85
91
void
select
(
const
QModelIndex &index, QItemSelectionModel::SelectionFlags command )
override
92
{
93
Q_UNUSED( index )
94
Q_UNUSED( command );
95
}
96
102
void
select
(
const
QItemSelection &selection, QItemSelectionModel::SelectionFlags command )
override
103
{
104
Q_UNUSED( selection )
105
Q_UNUSED( command );
106
}
107
114
virtual
void
selectFeatures(
const
QItemSelection &selection, QItemSelectionModel::SelectionFlags command );
115
116
virtual
void
setFeatureSelectionManager(
QgsIFeatureSelectionManager
*featureSelectionManager
SIP_TRANSFER
);
117
118
private
slots:
119
virtual
void
layerSelectionChanged(
const
QgsFeatureIds
&selected,
const
QgsFeatureIds
&deselected,
bool
clearAndSelect );
120
121
private
:
122
QModelIndexList expandIndexToRow(
const
QModelIndex &index )
const
;
123
124
private
:
125
QgsFeatureModel
*mFeatureModel =
nullptr
;
126
QgsIFeatureSelectionManager
*mFeatureSelectionManager =
nullptr
;
127
bool
mSyncEnabled =
true
;
128
133
QgsFeatureIds
mSelectedBuffer;
134
139
QgsFeatureIds
mDeselectedBuffer;
140
145
bool
mClearAndSelectBuffer =
false
;
146
};
147
148
#endif
// QGSFEATURESELECTIONMODEL_H
QgsFeatureModel
Base class for feature models.
Definition
qgsfeaturemodel.h:29
QgsFeatureSelectionModel::enableSync
void enableSync(bool enable)
Enables or disables synchronisation to the QgsVectorLayer When synchronisation is disabled,...
Definition
qgsfeatureselectionmodel.cpp:36
QgsFeatureSelectionModel::isSelected
virtual bool isSelected(QgsFeatureId fid)
Returns the selection status of a given feature id.
Definition
qgsfeatureselectionmodel.cpp:58
QgsFeatureSelectionModel::QgsFeatureSelectionModel
QgsFeatureSelectionModel(QAbstractItemModel *model, QgsFeatureModel *featureModel, QgsIFeatureSelectionManager *featureSelectionHandler, QObject *parent)
Definition
qgsfeatureselectionmodel.cpp:29
QgsFeatureSelectionModel::select
void select(const QItemSelection &selection, QItemSelectionModel::SelectionFlags command) override
Overwritten to do NOTHING (we handle selection ourselves).
Definition
qgsfeatureselectionmodel.h:102
QgsFeatureSelectionModel::requestRepaint
void requestRepaint(const QModelIndexList &indexes)
Request a repaint of a list of model indexes.
QgsFeatureSelectionModel::requestRepaint
void requestRepaint()
Request a repaint of the visible items of connected views.
QgsFeatureSelectionModel::select
void select(const QModelIndex &index, QItemSelectionModel::SelectionFlags command) override
Overwritten to do NOTHING (we handle selection ourselves).
Definition
qgsfeatureselectionmodel.h:91
QgsIFeatureSelectionManager
Is an interface class to abstract feature selection handling.
Definition
qgsifeatureselectionmanager.h:33
QgsVectorLayer
Represents a vector layer which manages a vector based dataset.
Definition
qgsvectorlayer.h:414
SIP_TRANSFERTHIS
#define SIP_TRANSFERTHIS
Definition
qgis_sip.h:52
SIP_TRANSFER
#define SIP_TRANSFER
Definition
qgis_sip.h:35
qgsfeatureid.h
QgsFeatureIds
QSet< QgsFeatureId > QgsFeatureIds
Definition
qgsfeatureid.h:41
QgsFeatureId
qint64 QgsFeatureId
64 bit feature ids negative numbers are used for uncommitted/newly added features
Definition
qgsfeatureid.h:32
Generated on
for QGIS API Documentation by
1.17.0