Skip to content
Permalink
Browse files

Expression widget - Filter headers with no search results

  • Loading branch information
NathanW2 committed Feb 22, 2016
1 parent f1e1559 commit 83c57ef5fa4746eaf7d8cc66299b83a5700732d3
Showing with 15 additions and 1 deletion.
  1. +15 −1 src/gui/qgsexpressionbuilderwidget.cpp
@@ -797,9 +797,23 @@ bool QgsExpressionItemSearchProxy::filterAcceptsRow( int source_row, const QMode
QModelIndex index = sourceModel()->index( source_row, 0, source_parent );
QgsExpressionItem::ItemType itemType = QgsExpressionItem::ItemType( sourceModel()->data( index, QgsExpressionItem::ItemTypeRole ).toInt() );

if ( itemType == QgsExpressionItem::Header )
int count = sourceModel()->rowCount( index );
bool matchchild = false;
for ( int i = 0; i < count; ++i )
{
if ( filterAcceptsRow( i, index ) )
{
matchchild = true;
break;
}
}

if ( itemType == QgsExpressionItem::Header && matchchild )
return true;

if ( itemType == QgsExpressionItem::Header )
return false;

return QSortFilterProxyModel::filterAcceptsRow( source_row, source_parent );
}

0 comments on commit 83c57ef

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