16 #include <QItemSelectionModel> 34 , mFilterMode( ShowAll )
35 , mSelectedOnTop( false )
40 connect(
layer(), SIGNAL( selectionChanged() ), SLOT( selectionChanged() ) );
50 if ( leftSelected && !rightSelected )
54 else if ( rightSelected && !leftSelected )
56 return sortOrder() == Qt::DescendingOrder;
72 if ( mSelectedOnTop != selectedOnTop )
93 return mSelectedOnTop;
98 mFilteredFeatures = ids;
106 for (
int i = 0; i <
rowCount(); ++i )
116 if ( filterMode != mFilterMode )
140 Q_UNUSED( sourceParent );
141 switch ( mFilterMode )
182 void QgsAttributeTableFilterModel::selectionChanged()
189 else if ( mSelectedOnTop )
209 mFilteredFeatures.
clear();
218 if (
layer()->hasScaleBasedVisibility() &&
260 mFilteredFeatures << f.
id();
263 if ( t.elapsed() > 5000 )
266 emit progress( i, cancel );
295 QModelIndexList indexes;
void generateListOfVisibleFeatures()
Updates the list of currently visible features on the map canvas.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
const QgsGeometryMap & changedGeometries()
Changed geometries which are not commited.
QgsFeatureId rowToId(const QModelIndex &row)
Returns the feature id for a given model index.
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
Wrapper for iterator of features from vector data provider or vector layer.
void setSortRole(int role)
A rectangle specified with double values.
bool filterAcceptsRow(int sourceRow, const QModelIndex &sourceParent) const override
Returns true if the source row will be accepted.
bool selectedOnTop()
Returns if selected features are currently shown on top.
QgsAttributeTableModel * masterModel() const
Returns the table model this filter is using.
void setSelectedOnTop(bool selectedOnTop)
Changes the sort order of the features.
virtual void sort(int column, Qt::SortOrder order)
void setFilterMode(FilterMode filterMode)
Set the filter mode the filter will use.
virtual QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
virtual void setSourceModel(QAbstractItemModel *sourceModel)
void setFeature(const QgsFeature &feature)
Convenience function for setting a feature for the context.
void setRendererScale(double scale)
bool lessThan(const QModelIndex &left, const QModelIndex &right) const override
Used by the sorting algorithm.
const QgsChangedAttributesMap & changedAttributeValues()
Changed attributes values which are not commited.
QgsRectangle intersect(const QgsRectangle *rect) const
return the intersection with the given rectangle
The feature class encapsulates a single feature including its id, geometry and a list of field/values...
A model backed by a QgsVectorLayerCache which is able to provide feature/attribute information to a Q...
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
const QgsRectangle & filterRect() const
Get the rectangle from which features will be taken.
virtual Q_DECL_DEPRECATED bool willRenderFeature(QgsFeature &feat)
Returns whether the renderer will render a feature or not.
void setExtent(const QgsRectangle &extent)
QgsRectangle visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
Map canvas is a class for displaying all GIS data types on a canvas.
virtual int rowCount(const QModelIndex &parent) const
bool qgsVariantLessThan(const QVariant &lhs, const QVariant &rhs)
Compares two QVariant values and returns whether the first is less than the second.
QgsAttributeTableFilterModel(QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent=nullptr)
Make sure, the master model is already loaded, so the selection will get synchronized.
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
Needs to be called when a new render cycle is started.
virtual void setFilteredFeatures(const QgsFeatureIds &ids)
Specify a list of features, which the filter will accept.
The QgsMapSettings class contains configuration for rendering of the map.
virtual void stopRender(QgsRenderContext &context)=0
Needs to be called when a render cycle has finished to clean up.
QList< Key > keys() const
float maximumScale() const
Returns the maximum scale denominator at which the layer is visible.
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
static QgsExpressionContextScope * globalScope()
Creates a new scope which contains variables and functions relating to the global QGIS context...
FilterMode filterMode()
The current filterModel.
double scale() const
Return the calculated scale of the map.
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
QgsVectorLayerCache * layerCache() const
Returns the layer cache this model uses as backend.
void setDynamicSortFilter(bool enable)
const QgsMapToPixel & mapToPixel() const
void setSourceModel(QgsAttributeTableModel *sourceModel)
Set the attribute table model that backs this model.
QgsFeatureId id() const
Get the feature ID for this feature.
void extentsChanged()
Is called upon every change of the visible extents on the map canvas.
bool contains(const T &value) const
QgsExpressionContext & expressionContext()
Gets the expression context.
bool contains(const T &value) const
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
const QgsFeatureIds & selectedFeaturesIds() const
Return reference to identifiers of selected features.
const QgsFeatureMap & addedFeatures()
New features which are not commited.
Contains information about the context of a rendering operation.
QAbstractItemModel * sourceModel() const
virtual QModelIndex mapToSource(const QModelIndex &proxyIndex) const
Qt::SortOrder sortOrder() const
QVariant data(int role) const
QgsPoint mapToLayerCoordinates(QgsMapLayer *theLayer, QgsPoint point) const
transform point coordinates from output CRS to layer's CRS
virtual void sort(int column, Qt::SortOrder order=Qt::AscendingOrder) override
Sort by the given column using the given order.
virtual QModelIndex mapFromSource(const QModelIndex &sourceIndex) const
void setMapToPixel(const QgsMapToPixel &mtp)
bool isNull() const
test if the rectangle is null (all coordinates zero or after call to setMinimal()).
QgsFeatureId rowToId(int row) const
Maps row to feature id.
QgsFeatureIds filteredFeatures()
Get a list of currently filtered feature ids.
static QgsExpressionContextScope * projectScope()
Creates a new scope which contains variables and functions relating to the current QGIS project...
static QgsExpressionContextScope * layerScope(const QgsMapLayer *layer)
Creates a new scope which contains variables and functions relating to a QgsMapLayer.
virtual int capabilities()
returns bitwise OR-ed capabilities of the renderer
bool nextFeature(QgsFeature &f)
bool connect(const QObject *sender, const char *signal, const QObject *receiver, const char *method, Qt::ConnectionType type)
QgsFeatureIterator getFeatures(const QgsFeatureRequest &featureRequest=QgsFeatureRequest())
Query this VectorLayerCache for features.
QModelIndexList fidToIndexList(QgsFeatureId fid)
void prefetchColumnData(int column)
Caches the entire data for one column.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
virtual QModelIndex mapToMaster(const QModelIndex &proxyIndex) const
QModelIndex fidToIndex(QgsFeatureId fid) override