You might do it this way (it's just a concept):
QPtrList<QListViewItem> _items;
myItem *item = dynamic_cast<myItem>(this->firstChild());
while(item){
if(item->myBoolFunction()) _items.push_back(item);
item = dynamic_cast<myItem>(item->nextSibling());
}
for(QPtrList<QListViewItem>::iterator it = _items.begin(); it!=_items.end();++it){
takeItem(*it);
insertItem(*it); // or some other method like moveItem()
}
QPtrList<QListViewItem> _items;
myItem *item = dynamic_cast<myItem>(this->firstChild());
while(item){
if(item->myBoolFunction()) _items.push_back(item);
item = dynamic_cast<myItem>(item->nextSibling());
}
for(QPtrList<QListViewItem>::iterator it = _items.begin(); it!=_items.end();++it){
takeItem(*it);
insertItem(*it); // or some other method like moveItem()
}
To copy to clipboard, switch view to plain text mode
The first iteration looks for all items to move upwards, the second does the move.
Bookmarks