From e040853e8257825b3fdac7ff79281cce6b7e8f0c Mon Sep 17 00:00:00 2001 From: David Faure Date: Tue, 12 Jul 2016 09:06:45 +0200 Subject: [PATCH] KRecursiveFilterProxyModel: small optimization, call rowCount() only once --- src/krecursivefilterproxymodel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/krecursivefilterproxymodel.cpp b/src/krecursivefilterproxymodel.cpp index 9caf14a..10632ec 100644 --- a/src/krecursivefilterproxymodel.cpp +++ b/src/krecursivefilterproxymodel.cpp @@ -301,7 +301,8 @@ bool KRecursiveFilterProxyModel::filterAcceptsRow(int sourceRow, const QModelInd Q_ASSERT(source_index.isValid()); bool accepted = false; - for (int row = 0, rows = sourceModel()->rowCount(source_index); row < rows; ++row) { + const int numChildren = sourceModel()->rowCount(source_index); + for (int row = 0, rows = numChildren; row < rows; ++row) { if (filterAcceptsRow(row, source_index)) { accepted = true; break;