Letschki
11-01-2009 19:08:29
Hello,
i have a problem with the list widget. The destroyItem() method doesn't remove the item as it should. I managed to remove the problem using the following changes (diff file):
I am not 100% sure that the changes contain all steps needed to completly remove the list items. My QuickGui knowledge isn't that broad
I have never worked with diff files before. I hope it is usable
i have a problem with the list widget. The destroyItem() method doesn't remove the item as it should. I managed to remove the problem using the following changes (diff file):
--- C:\Users\Jörg\Desktop\QuickGUIList.cpp So Dez 21 18:01:08 2008
+++ D:\Source\eCore\Src\QuickGUI\src\QuickGUIList.cpp So Jan 11 19:46:19 2009
@@ -220,15 +220,29 @@
int count = 0;
for(std::list<ListItem*>::iterator it = mListItems.begin(); it != mListItems.end(); ++it)
{
- if(count == index)
+ if(count++ == index)
{
- OGRE_DELETE_T((*it),ListItem,Ogre::MEMCATEGORY_GENERAL);
- mListItems.erase(it);
+ std::vector<QuickGUI::Widget *>::iterator itChild = std::find(mChildren.begin(), mChildren.end(), *it);
+ if(itChild != mChildren.end()) {
+ this->removeChild(*itChild);
+ mListItems.erase(it);
+
+ // Set all positions of ListItems.
+ float y = 0;
+ for(std::list<ListItem*>::iterator it = mListItems.begin(); it != mListItems.end(); ++it)
+ {
+ (*it)->setPosition(Point(0,y));
+
+ y += mDesc->list_listItemHeight;
+ }
+ }
+ break;
}
}
// Update names and Indices
updateItemNamesAndIndices();
+ redraw();
}
bool List::fireListEvent(ListEvent e, EventArgs& args)
I am not 100% sure that the changes contain all steps needed to completly remove the list items. My QuickGui knowledge isn't that broad
I have never worked with diff files before. I hope it is usable