this->selectedItems() or this->selectedIndexes() ???
I need to get all selected items in QTableWidget and getting this error
Code:
QList<QTableWidgetItem *> items = this->selectedItems();
error: '((QTableWidget*)this)->QTableWidget::selectedItems' cannot be used as a function
when I try
Code:
QList<QTableWidgetItem *> items = this->selectedItems;
it crashes on items.size(); or items.at(0)
It works only if I use this->selectedIndexes(), but why can't use selectedItems() and what about selectedRanges() ??
Re: this->selectedItems() or this->selectedIndexes() ???
The correct way to get the list of all the selected item in QTableWidget
Code:
QList<QTableWidgetItem*> items = this->selectedItems();
Is your class ("this") a subclass of QTableWidget?
Post definition of "this" class.
What is the error when you use selectedItems()?
Re: this->selectedItems() or this->selectedIndexes() ???
obviously I was doing something wrong, its working now and no idea what was the fixed. sorry, and thanks for the tip
Re: this->selectedItems() or this->selectedIndexes() ???
Maybe you had declared a (member) variable called selectedItems?
Re: this->selectedItems() or this->selectedIndexes() ???
Yes , that exactly what happen