Commit c427650d authored by Eike Ziller's avatar Eike Ziller

Search results: Fix that auto-expand failed on first set of results

They were expanded but collapsed again when the model was reset in the
setShowReplaceUI(bool show) call. Avoid resetting the model by informing
about the data change individually.

Change-Id: I48a94f2aec5b5d31d11166a299a2463b757939fa
Task-number: QTCREATORBUG-14320
Reviewed-by: default avatarDavid Schulz <>
parent 76a4ed6b
......@@ -57,9 +57,21 @@ SearchResultTreeModel::~SearchResultTreeModel()
void SearchResultTreeModel::setShowReplaceUI(bool show)
m_showReplaceUI = show;
// We cannot send dataChanged for the whole hierarchy in one go,
// because all items in a dataChanged must have the same parent.
// Send dataChanged for each parent of children individually...
QList<QModelIndex> changeQueue;
while (!changeQueue.isEmpty()) {
const QModelIndex current = changeQueue.takeFirst();
int childCount = rowCount(current);
if (childCount > 0) {
emit dataChanged(index(0, 0, current), index(childCount - 1, 0, current));
for (int r = 0; r < childCount; ++r)
changeQueue.append(index(r, 0, current));
void SearchResultTreeModel::setTextEditorFont(const QFont &font, const SearchResultColor &color)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment