Skip to content
Permalink
Browse files

style and docs

  • Loading branch information
signedav committed Mar 16, 2020
1 parent d409c65 commit 5475cfd18cebbe39af52f09f782e58cc85bbb0c4
@@ -200,8 +200,8 @@ is shown.

void setFilterExpression( const QgsExpression &expression, const QgsExpressionContext &context );
%Docstring
Set the ``expression`` to be stored in case of the features need to be
filtered (like on filter or on main model data change).
Set the ``expression`` and the ``context`` to be stored in case of the features
need to be filtered again (like on filter or on main model data change).
%End

signals:
@@ -243,11 +243,14 @@ selection state of the feature in case selected features are to be shown on top.
void reloadVisible();
%Docstring
Is called upon every change of the visible extents on the map canvas or when data of
the master table model changes.
the master table model change.
When a change is signalled, the filter is updated and invalidated if needed.
%End

void filterFeatures();
%Docstring
Is called when the data changed of the main table moment to update the filter model.
%End

};

@@ -227,6 +227,12 @@ void QgsAttributeTableFilterModel::setAttributeTableConfig( const QgsAttributeTa
sort( config.sortExpression(), config.sortOrder() );
}

void QgsAttributeTableFilterModel::setFilterExpression( const QgsExpression &expression, const QgsExpressionContext &context )
{
mFilterExpression = expression;
mFilterExpressionContext = context;
}

void QgsAttributeTableFilterModel::sort( const QString &expression, Qt::SortOrder order )
{
if ( order != Qt::AscendingOrder && order != Qt::DescendingOrder )
@@ -395,16 +401,16 @@ void QgsAttributeTableFilterModel::filterFeatures()
return;

QgsFeatureIds filteredFeatures;
QgsDistanceArea myDa;
QgsDistanceArea distanceArea;

myDa.setSourceCrs( mTableModel->layer()->crs(), QgsProject::instance()->transformContext() );
myDa.setEllipsoid( QgsProject::instance()->ellipsoid() );
distanceArea.setSourceCrs( mTableModel->layer()->crs(), QgsProject::instance()->transformContext() );
distanceArea.setEllipsoid( QgsProject::instance()->ellipsoid() );

bool fetchGeom = mFilterExpression.needsGeometry();
const bool fetchGeom = mFilterExpression.needsGeometry();

QApplication::setOverrideCursor( Qt::WaitCursor );

mFilterExpression.setGeomCalculator( &myDa );
mFilterExpression.setGeomCalculator( &distanceArea );
mFilterExpression.setDistanceUnits( QgsProject::instance()->distanceUnits() );
mFilterExpression.setAreaUnits( QgsProject::instance()->areaUnits() );
QgsFeatureRequest request( mTableModel->request() );
@@ -222,10 +222,10 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub
void setAttributeTableConfig( const QgsAttributeTableConfig &config );

/**
* Set the \a expression to be stored in case of the features need to be
* filtered (like on filter or on main model data change).
* Set the \a expression and the \a context to be stored in case of the features
* need to be filtered again (like on filter or on main model data change).
*/
void setFilterExpression( const QgsExpression &expression, const QgsExpressionContext &context ) { mFilterExpression = expression; mFilterExpressionContext = context; }
void setFilterExpression( const QgsExpression &expression, const QgsExpressionContext &context );

signals:

@@ -262,11 +262,14 @@ class GUI_EXPORT QgsAttributeTableFilterModel: public QSortFilterProxyModel, pub

/**
* Is called upon every change of the visible extents on the map canvas or when data of
* the master table model changes.
* the master table model change.
* When a change is signalled, the filter is updated and invalidated if needed.
*/
void reloadVisible();

/**
* Is called when the data changed of the main table moment to update the filter model.
*/
void filterFeatures();

private slots:
@@ -215,7 +215,7 @@ class GUI_EXPORT QgsFeatureListView : public QListView
void editSelectionChanged( const QItemSelection &deselected, const QItemSelection &selected );

/**
* Emmits the signal for the feature and the selection information
* Emits the signal for the feature and the selection information
*/
void updateEditSelectionDependencies();

0 comments on commit 5475cfd

Please sign in to comment.
You can’t perform that action at this time.