mirror of
https://github.com/qgis/QGIS.git
synced 2025-03-12 00:02:25 -04:00
Fix conditional styles in feature list view do not update when
the layer's conditional styles are changed
This commit is contained in:
parent
5f7264d4d1
commit
bccd5a4610
@ -31,10 +31,15 @@ QgsFeatureListModel::QgsFeatureListModel( QgsAttributeTableFilterModel *sourceMo
|
||||
|
||||
void QgsFeatureListModel::setSourceModel( QgsAttributeTableFilterModel *sourceModel )
|
||||
{
|
||||
if ( mSourceLayer )
|
||||
disconnect( mSourceLayer->conditionalStyles(), &QgsConditionalLayerStyles::changed, this, &QgsFeatureListModel::conditionalStylesChanged );
|
||||
|
||||
QSortFilterProxyModel::setSourceModel( sourceModel );
|
||||
mExpressionContext = sourceModel->layer()->createExpressionContext();
|
||||
mFilterModel = sourceModel;
|
||||
|
||||
mSourceLayer = sourceModel->layer();
|
||||
connect( mSourceLayer->conditionalStyles(), &QgsConditionalLayerStyles::changed, this, &QgsFeatureListModel::conditionalStylesChanged );
|
||||
}
|
||||
|
||||
QgsVectorLayerCache *QgsFeatureListModel::layerCache()
|
||||
@ -265,6 +270,12 @@ void QgsFeatureListModel::onEndInsertRows( const QModelIndex &parent, int first,
|
||||
endInsertRows();
|
||||
}
|
||||
|
||||
void QgsFeatureListModel::conditionalStylesChanged()
|
||||
{
|
||||
mRowStylesMap.clear();
|
||||
emit dataChanged( index( 0, 0 ), index( rowCount() - 1, columnCount() - 1 ) );
|
||||
}
|
||||
|
||||
bool QgsFeatureListModel::sortByDisplayExpression() const
|
||||
{
|
||||
return mSortByDisplayExpression;
|
||||
|
@ -185,6 +185,10 @@ class GUI_EXPORT QgsFeatureListModel : public QSortFilterProxyModel, public QgsF
|
||||
*/
|
||||
Q_DECL_DEPRECATED void onEndInsertRows( const QModelIndex &parent, int first, int last );
|
||||
|
||||
private slots:
|
||||
|
||||
void conditionalStylesChanged();
|
||||
|
||||
private:
|
||||
mutable QgsExpression mDisplayExpression;
|
||||
QgsAttributeTableFilterModel *mFilterModel = nullptr;
|
||||
@ -193,6 +197,7 @@ class GUI_EXPORT QgsFeatureListModel : public QSortFilterProxyModel, public QgsF
|
||||
mutable QgsExpressionContext mExpressionContext;
|
||||
mutable QMap< QgsFeatureId, QList<QgsConditionalStyle> > mRowStylesMap;
|
||||
bool mSortByDisplayExpression = false;
|
||||
QPointer< QgsVectorLayer > mSourceLayer;
|
||||
};
|
||||
|
||||
Q_DECLARE_METATYPE( QgsFeatureListModel::FeatureInfo )
|
||||
|
Loading…
x
Reference in New Issue
Block a user