[SOLVED]Problem while using 'itemFromIndex'.
I have a listWidget in my form and I decided using it's
on_listView_clicked(const QModelIndex &index)
In the slot implementation I want to get the item clicked each time so since I have the item index I thought about using
QListWidgetItem * curItm = ui->listView->itemFromIndex(index);
But I get the error:
'itemFromIndex' is a protected member of 'QListWidget'
How can I use this particular function?
Since this is a protected method (I do not know why) then what one could do is subclass
QListWidget. If that is not a n option maybe an alternative could be using
QListWidgetItem* curItm = ui->listView->item(index->row());
Why not use the currentItemChanged signal ?
Mainly because I have also put checkboxes next to each item. I still want the function to fire up no matter if the user clicks the checkbox or the item.
That is why I think what I suggest (only in this case) is a better idea.