1/************************************************************************ 2 * This file has been generated automatically from * 3 * * 4 * src/gui/attributetable/qgsattributetablefiltermodel.h * 5 * * 6 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 7 ************************************************************************/ 8 9 10 11 12 13class QgsAttributeTableFilterModel: QSortFilterProxyModel, QgsFeatureModel 14{ 15 16%TypeHeaderCode 17#include "qgsattributetablefiltermodel.h" 18%End 19 public: 20 21 enum FilterMode 22 { 23 ShowAll, 24 ShowSelected, 25 ShowVisible, 26 ShowFilteredList, 27 ShowEdited 28 }; 29 30 enum ColumnType 31 { 32 ColumnTypeField, 33 ColumnTypeActionButton 34 }; 35 36 enum Role 37 { 38 TypeRole 39 }; 40 41 42 QgsAttributeTableFilterModel( QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent /TransferThis/ = 0 ); 43%Docstring 44Make sure, the master model is already loaded, so the selection will get synchronized. 45 46:param parent: parent object (owner) 47:param sourceModel: The QgsAttributeTableModel to use as source (mostly referred to as master model) 48:param canvas: The mapCanvas. Used to identify the currently visible features. 49%End 50 51 void setSourceModel( QgsAttributeTableModel *sourceModel ); 52%Docstring 53Set the attribute table model that backs this model 54 55:param sourceModel: The model 56 57.. versionadded:: 2.0 58%End 59 60 void setSelectedOnTop( bool selectedOnTop ); 61%Docstring 62Changes the sort order of the features. If set to ``True``, selected features 63will be sorted on top, regardless of the current sort column 64 65:param selectedOnTop: Specify, if selected features should be sorted on top 66%End 67 68 bool selectedOnTop(); 69%Docstring 70Returns if selected features are currently shown on top 71 72:return: ``True`` if selected are shown on top 73%End 74 75 virtual void setFilteredFeatures( const QgsFeatureIds &ids ); 76%Docstring 77Specify a list of features, which the filter will accept. 78The filter mode will automatically be adjusted to show only these features (ShowFilteredList). 79 80:param ids: The list of feature ids which will be accepted by the filter 81%End 82 83 QgsFeatureIds filteredFeatures(); 84%Docstring 85Gets a list of currently filtered feature ids 86 87:return: A list of feature ids 88%End 89 90 void setFilterMode( FilterMode filterMode ); 91%Docstring 92Set the filter mode the filter will use. 93 94:param filterMode: Sets the current mode of the filter 95%End 96 97 void disconnectFilterModeConnections(); 98%Docstring 99Disconnect the connections set for the current filterMode 100%End 101 102 void connectFilterModeConnections( FilterMode filterMode ); 103%Docstring 104Disconnect the connections set for the new ``filterMode`` 105%End 106 107 FilterMode filterMode(); 108%Docstring 109The current filterModel 110%End 111 112 QgsVectorLayer *layer() const; 113%Docstring 114Returns the layer this filter acts on. 115 116:return: Abovementioned layer 117%End 118 119 QgsVectorLayerCache *layerCache() const; 120%Docstring 121Returns the layerCache this filter acts on. 122 123:return: The layer cache 124%End 125 126 QgsAttributeTableModel *masterModel() const; 127%Docstring 128Returns the table model this filter is using 129 130:return: the table model in quesion 131%End 132 133 QgsFeatureId rowToId( const QModelIndex &row ); 134%Docstring 135Returns the feature id for a given model index. 136 137:param row: A model index of the row in question 138 139:return: The feature id of the feature visible in the provided row 140%End 141 142 virtual QModelIndex fidToIndex( QgsFeatureId fid ); 143 144 145 QModelIndexList fidToIndexList( QgsFeatureId fid ); 146 147 QModelIndex mapToMaster( const QModelIndex &proxyIndex ) const; 148 149 QModelIndex mapFromMaster( const QModelIndex &sourceIndex ) const; 150 151 virtual QModelIndex mapToSource( const QModelIndex &proxyIndex ) const; 152 153 154 virtual QModelIndex mapFromSource( const QModelIndex &sourceIndex ) const; 155 156 157 virtual Qt::ItemFlags flags( const QModelIndex &index ) const; 158 159 160 virtual void sort( int column, Qt::SortOrder order = Qt::AscendingOrder ); 161 162%Docstring 163Sort by the given column using the given order. 164Prefetches all the data from the layer to speed up sorting. 165 166:param column: The column which should be sorted 167:param order: The order ( Qt.AscendingOrder or Qt.DescendingOrder ) 168%End 169 170 void sort( const QString &expression, Qt::SortOrder order = Qt::AscendingOrder ); 171%Docstring 172Sort by the given expression using the given order. 173Prefetches all the data from the layer to speed up sorting. 174 175:param expression: The expression which should be used for sorting 176:param order: The order ( Qt.AscendingOrder or Qt.DescendingOrder ) 177%End 178 179 QString sortExpression() const; 180%Docstring 181The expression which is used to sort the attribute table. 182%End 183 184 QgsMapCanvas *mapCanvas() const; 185%Docstring 186Returns the map canvas 187%End 188 189 virtual QVariant data( const QModelIndex &index, int role ) const; 190 191 192 virtual QVariant headerData( int section, Qt::Orientation orientation, int role ) const; 193 194 195 int actionColumnIndex() const; 196%Docstring 197Gets the index of the first column that contains an action widget. 198Returns -1 if none is defined. 199%End 200 201 virtual int columnCount( const QModelIndex &parent ) const; 202 203 204 void setAttributeTableConfig( const QgsAttributeTableConfig &config ); 205%Docstring 206Set the attribute table configuration to control which fields are shown, 207in which order they are shown as well as if and where an action column 208is shown. 209%End 210 211 void setFilterExpression( const QgsExpression &expression, const QgsExpressionContext &context ); 212%Docstring 213Set the ``expression`` and the ``context`` to be stored in case of the features 214need to be filtered again (like on filter or on main model data change). 215 216.. versionadded:: 3.10.3 217%End 218 219 signals: 220 221 void sortColumnChanged( int column, Qt::SortOrder order ); 222%Docstring 223Emitted whenever the sort column is changed 224 225:param column: The sort column 226:param order: The sort order 227%End 228 229 void featuresFiltered(); 230%Docstring 231Emitted when the filtering of the features has been done 232%End 233 234 void visibleReloaded(); 235%Docstring 236Emitted when the the visible features on extend are reloaded (the list is created) 237%End 238 239 void filterError( const QString &errorMessage ); 240%Docstring 241Emitted when an error occurred while filtering features 242 243.. versionadded:: 3.18 244%End 245 246 protected: 247 248 virtual bool filterAcceptsRow( int sourceRow, const QModelIndex &sourceParent ) const; 249 250%Docstring 251Returns ``True`` if the source row will be accepted 252 253:param sourceRow: row from the source model 254:param sourceParent: parent index in the source model 255%End 256 257 void generateListOfVisibleFeatures(); 258%Docstring 259Updates the list of currently visible features on the map canvas. 260Is called automatically when the filter mode is adjusted or the extents changed. 261%End 262 263 virtual bool lessThan( const QModelIndex &left, const QModelIndex &right ) const; 264 265%Docstring 266Used by the sorting algorithm. Compares the two model indices. Will also consider the 267selection state of the feature in case selected features are to be shown on top. 268%End 269 270 public slots: 271 272 void extentsChanged(); 273%Docstring 274Is called upon every change of the visible extents on the map canvas. 275When a change is signalled, the filter is updated and invalidated if needed. 276 277.. deprecated:: QGIS 3.10.3 278 - made private as reloadVisible() 279%End 280 281 void filterFeatures(); 282%Docstring 283Updates the filtered features in the filter model. It is called when the data of the 284main table or the filter expression changed. 285 286.. versionadded:: 3.10.3 287%End 288 289}; 290 291/************************************************************************ 292 * This file has been generated automatically from * 293 * * 294 * src/gui/attributetable/qgsattributetablefiltermodel.h * 295 * * 296 * Do not edit manually ! Edit header and run scripts/sipify.pl again * 297 ************************************************************************/ 298