Skip to content

Commit 83c57ef

Browse files
committed
Expression widget - Filter headers with no search results
1 parent f1e1559 commit 83c57ef

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

src/gui/qgsexpressionbuilderwidget.cpp

+15-1
Original file line numberDiff line numberDiff line change
@@ -797,9 +797,23 @@ bool QgsExpressionItemSearchProxy::filterAcceptsRow( int source_row, const QMode
797797
QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
798798
QgsExpressionItem::ItemType itemType = QgsExpressionItem::ItemType( sourceModel()->data( index, QgsExpressionItem::ItemTypeRole ).toInt() );
799799

800-
if ( itemType == QgsExpressionItem::Header )
800+
int count = sourceModel()->rowCount( index );
801+
bool matchchild = false;
802+
for ( int i = 0; i < count; ++i )
803+
{
804+
if ( filterAcceptsRow( i, index ) )
805+
{
806+
matchchild = true;
807+
break;
808+
}
809+
}
810+
811+
if ( itemType == QgsExpressionItem::Header && matchchild )
801812
return true;
802813

814+
if ( itemType == QgsExpressionItem::Header )
815+
return false;
816+
803817
return QSortFilterProxyModel::filterAcceptsRow( source_row, source_parent );
804818
}
805819

0 commit comments

Comments
 (0)