Page 1 of 1

Bug in Tree::getNextSelectedItemFromList

Posted: Thu Jul 30, 2009 02:29
by earthsruler
Hey all.

Now I know that generally there is nothing but hate for the current tree widget implementation, but none the less i have found a bug in it and fixed it.

The function Tree::getNextSelectedItemFromList wouldn't actually find the next selected item if the current selected item was on a different branch of the tree of nested deeper than the next selected one, if that makes sense :)

This can be fixed quite simply by making the foundStartItem paramater a reference:

Code: Select all

TreeItem* Tree::getNextSelectedItemFromList(const LBItemList &itemList, const TreeItem* startItem, bool& foundStartItem) const


after that items found on a branch will be notified to their recursive parent calls. YAY! This will generate 3 errors from places calling it but that is an easy fix like this:

Code: Select all

bool found = true;
getNextSelectedItemFromList( itemList, startItem, found );


instead of:

Code: Select all

getNextSelectedItemFromList( itemList, startItem, true );


Thanks!

Re: Bug in Tree::getNextSelectedItemFromList

Posted: Fri Jul 31, 2009 08:37
by CrazyEddie
Hi,

Thanks for this, I'll have a closer look and probably make the change over the weekend :)

CE.

Re: Bug in Tree::getNextSelectedItemFromList

Posted: Wed Aug 19, 2009 09:28
by CrazyEddie
Ok, this morning I (finally!) got around to making this change (in trunk, since I'm done with v0-6).

Thanks again :)

CE.