ravenous
Practically a Master Poster
681 posts since Jul 2005
Reputation Points: 286
Solved Threads: 111
Skill Endorsements: 9
I think the second error says the functions is constant so i can't modify it. But i have to modify it. any way to do it.
No, the problem is that you're doing item->itemFromIndex(&a) when you should do item->itemFromIndex(a) .
Actually, I think that you will get another error when you fix this, since QListWidget::itemFromIndex is a protected function. If you want to want to get all the items in a QListWidget you can just do:
QList< QListWidgetItem* > items = listWidget->items();
and then iterate over the list like any other, doing things to the items as you go. If you want to get the currently selected item, then you can just do:
QListWidgetItem* pCurrentItem = listWidget->currentItem();
Hope that helps :)
ravenous
Practically a Master Poster
681 posts since Jul 2005
Reputation Points: 286
Solved Threads: 111
Skill Endorsements: 9