Reviewing merge request #2260: Fixing bug with q3listview sorting

Q3ListViewItem::sortChildItems() exits early if there is only 1 child
item and leaves grandchildren unsorted.

Commits that would be merged:

Version 3
  • Version 1
  • Version 2
  • Version 3
  • f29f1bb
  • ae95cde
  • Q3ListViewItem grandchildren not sorted if item has one child

  • 4fbb8cf
  • Auto test added for q3listview sorting bug

  • 9a7c583
  • Call sortChildItems() only if item is opened.

Showing f29f1bb-ae95cde

Comments

→ State changed from New to Revise and resubmit

The continuation of the function calls:
if (siblings[i].item->isOpen())

        siblings[i].item->sort();

I think the same should be done if there is one child.

Can you please make an autotest?

If the early return is fixed the continuation would call sort on the child, so semantically the lines:

if (childItem->siblingItem == 0)
{

childItem->sortChildItems(column, ascending);
return;  

}

are not needed. I put them there to avoid cost of setting up the env for sorting that also involves memory allocation. All that was not needed.

Can you please make an autotest?

Can you please what you mean by autotest? Is there a Qt test suite already where I shall add an extra test or you want me to make a standalone program that demonstrates the bug and its fix?

An autottest is a test in tests/auto/

My question was why calling sortChildItems instead of isOpen() and sort()

Auto test is added.

Calling sortChildItems() only if the item is opened is a very good idea :)
That is also changed now.

→ State changed from Revise and resubmit to Merged

Merged in 9bba92715d96939e4d36c6ea42e8b466756bf891

Add a new comment:

Login or create an account to post a comment

How to apply this merge request to your repository