Subgroup: Attribute
Class: QgsAttributeTableFilterModel¶
-
class
qgis.gui.
QgsAttributeTableFilterModel
(canvas: QgsMapCanvas, sourceModel: QgsAttributeTableModel, parent: QObject = None)¶ Bases:
PyQt5.QtCore.QSortFilterProxyModel
,qgis._gui.QgsFeatureModel
Make sure, the master model is already loaded, so the selection will get synchronized.
Parameters: - parent – parent object (owner)
- sourceModel – The QgsAttributeTableModel to use as source (mostly referred to as master model)
- canvas –
The mapCanvas. Used to identify the currently visible features.
Methods
actionColumnIndex
Get the index of the first column that contains an action widget. beginInsertColumns
beginInsertRows
beginMoveColumns
beginMoveRows
beginRemoveColumns
beginRemoveRows
beginResetModel
blockSignals
buddy
canDropMimeData
canFetchMore
changePersistentIndex
changePersistentIndexList
childEvent
children
columnCount
connectNotify
createIndex
customEvent
data
decodeData
deleteLater
disconnect
disconnectNotify
dropMimeData
dumpObjectInfo
dumpObjectTree
dynamicPropertyNames
dynamicSortFilter
encodeData
endInsertColumns
endInsertRows
endMoveColumns
endMoveRows
endRemoveColumns
endRemoveRows
endResetModel
event
eventFilter
extentsChanged
Is called upon every change of the visible extents on the map canvas. fetchMore
fidToIndex
fidToIndexList
filterAcceptsColumn
filterAcceptsRow
Returns true if the source row will be accepted filterCaseSensitivity
filterKeyColumn
filterMode
The current filterModel filterRegExp
filterRole
filteredFeatures
Get a list of currently filtered feature ids findChild
findChild(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> QObject findChildren
findChildren(self, Tuple, name: str = ‘’, options: Union[Qt.FindChildOptions, Qt.FindChildOption] = Qt.FindChildrenRecursively) -> List[QObject] flags
generateListOfVisibleFeatures
Updates the list of currently visible features on the map canvas. hasChildren
hasIndex
headerData
index
inherits
insertColumn
insertColumns
insertRow
insertRows
installEventFilter
invalidate
invalidateFilter
isSignalConnected
isSortLocaleAware
isWidgetType
isWindowType
itemData
killTimer
layer
Returns the layer this filter acts on. layerCache
Returns the layerCache this filter acts on. lessThan
Used by the sorting algorithm. mapCanvas
Returns the map canvas mapFromMaster
mapFromSource
mapSelectionFromSource
mapSelectionToSource
mapToMaster
mapToSource
masterModel
Returns the table model this filter is using match
metaObject
mimeData
mimeTypes
moveColumn
moveColumns
moveRow
moveRows
moveToThread
objectName
parent
parent(self) -> QObject persistentIndexList
property
pyqtConfigure
Each keyword argument is either the name of a Qt property or a Qt signal. receivers
removeColumn
removeColumns
removeEventFilter
removeRow
removeRows
resetInternalData
revert
roleNames
rowCount
rowToId
Returns the feature id for a given model index. selectedOnTop
Returns if selected features are currently shown on top sender
senderSignalIndex
setAttributeTableConfig
Set the attribute table configuration to control which fields are shown, in which order they are shown as well as if and where an action column is shown. setData
setDynamicSortFilter
setFilterCaseSensitivity
setFilterFixedString
setFilterKeyColumn
setFilterMode
Set the filter mode the filter will use. setFilterRegExp
setFilterRegExp(self, str) setFilterRole
setFilterWildcard
setFilteredFeatures
Specify a list of features, which the filter will accept. setHeaderData
setItemData
setObjectName
setParent
setProperty
setSelectedOnTop
Changes the sort order of the features. setSortCaseSensitivity
setSortLocaleAware
setSortRole
setSourceModel
Set the attribute table model that backs this model sibling
signalsBlocked
sort
Sort by the given column using the given order. sortCaseSensitivity
sortColumn
sortExpression
The expression which is used to sort the attribute table. sortOrder
sortRole
sourceModel
span
startTimer
submit
supportedDragActions
supportedDropActions
thread
timerEvent
tr
Attributes
ColumnTypeActionButton
ColumnTypeField
HorizontalSortHint
NoLayoutChangeHint
ShowAll
ShowEdited
ShowFilteredList
ShowSelected
ShowVisible
TypeRole
VerticalSortHint
columnsAboutToBeInserted
columnsAboutToBeInserted(self, QModelIndex, int, int) [signal] columnsAboutToBeMoved
columnsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal] columnsAboutToBeRemoved
columnsAboutToBeRemoved(self, QModelIndex, int, int) [signal] columnsInserted
columnsInserted(self, QModelIndex, int, int) [signal] columnsMoved
columnsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal] columnsRemoved
columnsRemoved(self, QModelIndex, int, int) [signal] dataChanged
dataChanged(self, QModelIndex, QModelIndex, Iterable[int] = []) [signal] destroyed
destroyed(self, QObject = None) [signal] layoutAboutToBeChanged
layoutAboutToBeChanged(self, object = QList<QPersistentModelIndex>(), QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal] layoutChanged
layoutChanged(self, Iterable[QPersistentModelIndex] = [], QAbstractItemModel.LayoutChangeHint = QAbstractItemModel.NoLayoutChangeHint) [signal] modelAboutToBeReset
modelAboutToBeReset(self) [signal] modelReset
modelReset(self) [signal] objectNameChanged
objectNameChanged(self, str) [signal] rowsAboutToBeInserted
rowsAboutToBeInserted(self, QModelIndex, int, int) [signal] rowsAboutToBeMoved
rowsAboutToBeMoved(self, QModelIndex, int, int, QModelIndex, int) [signal] rowsAboutToBeRemoved
rowsAboutToBeRemoved(self, QModelIndex, int, int) [signal] rowsInserted
rowsInserted(self, QModelIndex, int, int) [signal] rowsMoved
rowsMoved(self, QModelIndex, int, int, QModelIndex, int) [signal] rowsRemoved
rowsRemoved(self, QModelIndex, int, int) [signal] sourceModelChanged
sourceModelChanged(self) [signal] staticMetaObject
-
class
ColumnType
¶ Bases:
int
-
ColumnTypeActionButton
= 1¶
-
ColumnTypeField
= 0¶
-
class
FilterMode
¶ Bases:
int
-
class
Role
¶ Bases:
int
-
ShowAll
= 0¶
-
ShowEdited
= 4¶
-
ShowFilteredList
= 3¶
-
ShowSelected
= 1¶
-
ShowVisible
= 2¶
-
TypeRole
= 260¶
-
actionColumnIndex
(self) → int¶ Get the index of the first column that contains an action widget. Returns -1 if none is defined.
-
beginInsertColumns
()¶
-
beginInsertRows
()¶
-
beginMoveColumns
()¶
-
beginMoveRows
()¶
-
beginRemoveColumns
()¶
-
beginRemoveRows
()¶
-
beginResetModel
()¶
-
changePersistentIndex
()¶
-
changePersistentIndexList
()¶
-
childEvent
()¶
-
columnCount
(self, parent: QModelIndex) → int¶
-
connectNotify
()¶
-
createIndex
()¶
-
customEvent
()¶
-
data
(self, index: QModelIndex, role: int) → Any¶
-
decodeData
()¶
-
disconnectNotify
()¶
-
encodeData
()¶
-
endInsertColumns
()¶
-
endInsertRows
()¶
-
endMoveColumns
()¶
-
endMoveRows
()¶
-
endRemoveColumns
()¶
-
endRemoveRows
()¶
-
endResetModel
()¶
-
extentsChanged
(self)¶ Is called upon every change of the visible extents on the map canvas. When a change is signalled, the filter is updated and invalidated if needed.
-
fidToIndex
(self, fid: int) → QModelIndex¶
-
fidToIndexList
(self, fid: int) → object¶
-
filterAcceptsColumn
()¶
-
filterAcceptsRow
(self, sourceRow: int, sourceParent: QModelIndex) → bool¶ Returns true if the source row will be accepted
Parameters: - sourceRow – row from the source model
- sourceParent – parent index in the source model
-
filterMode
(self) → QgsAttributeTableFilterModel.FilterMode¶ The current filterModel
-
filteredFeatures
(self) → object¶ Get a list of currently filtered feature ids
Returns: A list of feature ids
-
flags
(self, index: QModelIndex) → Qt.ItemFlags¶
-
generateListOfVisibleFeatures
(self)¶ Updates the list of currently visible features on the map canvas. Is called automatically when the filter mode is adjusted or the extents changed.
-
headerData
(self, section: int, orientation: Qt.Orientation, role: int) → Any¶
-
invalidateFilter
()¶
-
isSignalConnected
()¶
-
layer
(self) → QgsVectorLayer¶ Returns the layer this filter acts on.
Returns: Abovementioned layer
-
layerCache
(self) → QgsVectorLayerCache¶ Returns the layerCache this filter acts on.
Returns: The layer cache
-
lessThan
(self, left: QModelIndex, right: QModelIndex) → bool¶ Used by the sorting algorithm. Compares the two model indices. Will also consider the selection state of the feature in case selected features are to be shown on top.
-
mapCanvas
(self) → QgsMapCanvas¶ Returns the map canvas
-
mapFromMaster
(self, sourceIndex: QModelIndex) → QModelIndex¶
-
mapFromSource
(self, sourceIndex: QModelIndex) → QModelIndex¶
-
mapToMaster
(self, proxyIndex: QModelIndex) → QModelIndex¶
-
mapToSource
(self, proxyIndex: QModelIndex) → QModelIndex¶
-
masterModel
(self) → QgsAttributeTableModel¶ Returns the table model this filter is using
Returns: the table model in quesion
-
persistentIndexList
()¶
-
receivers
()¶
-
resetInternalData
()¶
-
rowToId
(self, row: QModelIndex) → int¶ Returns the feature id for a given model index.
Parameters: row – A model index of the row in question Returns: The feature id of the feature visible in the provided row
-
selectedOnTop
(self) → bool¶ Returns if selected features are currently shown on top
Returns: True if selected are shown on top
-
sender
()¶
-
senderSignalIndex
()¶
-
setAttributeTableConfig
(self, config: QgsAttributeTableConfig)¶ Set the attribute table configuration to control which fields are shown, in which order they are shown as well as if and where an action column is shown.
-
setFilterMode
(self, filterMode: QgsAttributeTableFilterModel.FilterMode)¶ Set the filter mode the filter will use.
Parameters: filterMode – Sets the current mode of the filter
-
setFilteredFeatures
(self, ids: object)¶ Specify a list of features, which the filter will accept. The filter mode will automatically be adjusted to show only these features (ShowFilteredList).
Parameters: ids – The list of feature ids which will be accepted by the filter
-
setSelectedOnTop
(self, selectedOnTop: bool)¶ Changes the sort order of the features. If set to true, selected features will be sorted on top, regardless of the current sort column
Parameters: selectedOnTop – Specify, if selected features should be sorted on top
-
setSourceModel
(self, sourceModel: QgsAttributeTableModel)¶ Set the attribute table model that backs this model
Parameters: sourceModel – The model New in version 2.0.
-
sort
(self, column: int, order: Qt.SortOrder = Qt.AscendingOrder)¶ Sort by the given column using the given order. Prefetches all the data from the layer to speed up sorting.
Parameters: - column – The column which should be sorted
- order – The order ( Qt.AscendingOrder or Qt.DescendingOrder )
sort(self, expression: str, order: Qt.SortOrder = Qt.AscendingOrder) Sort by the given expression using the given order. Prefetches all the data from the layer to speed up sorting.
Parameters: - expression – The expression which should be used for sorting
- order – The order ( Qt.AscendingOrder or Qt.DescendingOrder )
-
sortExpression
(self) → str¶ The expression which is used to sort the attribute table.
-
timerEvent
()¶