16 #include <QItemSelectionModel>
33 , mFilterMode( ShowAll )
34 , mSelectedOnTop( false )
39 connect(
layer(), SIGNAL( selectionChanged() ), SLOT( selectionChanged() ) );
49 if ( leftSelected && !rightSelected )
53 else if ( rightSelected && !leftSelected )
55 return sortOrder() == Qt::DescendingOrder;
69 switch ( leftData.
type() )
73 case QVariant::LongLong:
74 case QVariant::ULongLong:
77 case QVariant::Double:
83 case QVariant::DateTime:
102 if ( mSelectedOnTop != selectedOnTop )
123 return mSelectedOnTop;
128 mFilteredFeatures = ids;
136 for (
int i = 0; i <
rowCount(); ++i )
146 if ( filterMode != mFilterMode )
170 Q_UNUSED( sourceParent );
171 switch ( mFilterMode )
211 void QgsAttributeTableFilterModel::selectionChanged()
218 else if ( mSelectedOnTop )
235 mFilteredFeatures.
clear();
244 if (
layer()->hasScaleBasedVisibility() &&
285 mFilteredFeatures << f.
id();
288 if ( t.elapsed() > 5000 )
291 emit progress( i, cancel );
320 QModelIndexList indexes;
QgsFeatureId id() const
Get the feature ID for this feature.
void generateListOfVisibleFeatures()
Updates the list of currently visible features on the map canvas.
virtual QModelIndex index(int row, int column, const QModelIndex &parent) const
qlonglong toLongLong(bool *ok) const
QgsFeatureId rowToId(const QModelIndex &row)
Returns the feature id for a given model index.
Wrapper for iterator of features from vector data provider or vector layer.
void setSortRole(int role)
QgsFeatureRendererV2 * rendererV2()
Return renderer V2.
virtual bool willRenderFeature(QgsFeature &feat)
return whether the renderer will render a feature or not.
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.
double scale() const
Return the calculated scale of the map.
int localeAwareCompare(const QString &other) const
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.
const QgsRectangle & filterRect() const
virtual void setSourceModel(QAbstractItemModel *sourceModel)
QDateTime toDateTime() const
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 visibleExtent() const
Return the actual extent derived from requested extent that takes takes output image size into accoun...
const QgsMapSettings & mapSettings() const
Get access to properties used for map rendering.
const QgsMapToPixel & mapToPixel() const
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...
QgsPoint mapToLayerCoordinates(QgsMapLayer *theLayer, QgsPoint point) const
transform point coordinates from output CRS to layer's CRS
bool disconnect(const QObject *sender, const char *signal, const QObject *receiver, const char *method)
void setExtent(const QgsRectangle &extent)
Map canvas is a class for displaying all GIS data types on a canvas.
virtual int rowCount(const QModelIndex &parent) const
virtual void startRender(QgsRenderContext &context, const QgsFields &fields)=0
The QgsMapSettings class contains configuration for rendering of the map.
virtual void stopRender(QgsRenderContext &context)=0
QgsVectorLayer * layer() const
Returns the layer this filter acts on.
QList< Key > keys() const
QgsVectorLayerEditBuffer * editBuffer()
Buffer with uncommitted editing operations. Only valid after editing has been turned on...
FilterMode filterMode()
The current filterModel.
QgsAttributeTableFilterModel(QgsMapCanvas *canvas, QgsAttributeTableModel *sourceModel, QObject *parent=0)
Make sure, the master model is already loaded, so the selection will get synchronized.
const QgsFeatureIds & selectedFeaturesIds() const
Return reference to identifiers of selected features.
virtual QModelIndex mapToMaster(const QModelIndex &proxyIndex) const
float maximumScale() const
Returns the maximum scale denominator at which the layer is visible.
This class wraps a request for features to a vector layer (or directly its vector data provider)...
void setDynamicSortFilter(bool enable)
Filter using a rectangle, no need to set NoGeometry.
FilterType filterType() const
QgsVectorLayerCache * layerCache() const
Returns the layer cache this model uses as backend.
void setSourceModel(QgsAttributeTableModel *sourceModel)
Set the attribute table model that backs this model.
void extentsChanged()
Is called upon every change of the visible extents on the map canvas.
bool contains(const T &value) const
bool contains(const T &value) const
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
QgsAttributeTableModel * masterModel() const
Returns the table model this filter is using.
virtual QModelIndex mapFromMaster(const QModelIndex &sourceIndex) const
Qt::SortOrder sortOrder() const
QVariant data(int role) const
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
QgsRectangle intersect(const QgsRectangle *rect) const
return the intersection with the given rectangle
void setMapToPixel(const QgsMapToPixel &mtp)
QgsFeatureIds filteredFeatures()
Get a list of currently filtered feature ids.
double toDouble(bool *ok) const
QgsRectangle extent() const
Returns the current zoom exent of the map canvas.
QgsFeatureId rowToId(int row) const
Maps row to feature id.
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)
virtual void setFilteredFeatures(QgsFeatureIds ids)
Specify a list of features, which the filter will accept.
void prefetchColumnData(int column)
Caches the entire data for one column.
QgsFeatureRequest & setFilterRect(const QgsRectangle &rect)
Set rectangle from which features will be taken.
QModelIndex fidToIndex(QgsFeatureId fid) override