Ryan Riffle
16th January 2011, 04:12
I'm wanting to unselect the only (1) selected item in my QTreeWidget,
but when I use my code, It returns:
ASSERT failure in QList<T>::at: "index out of range", file /usr/include/qt4/QtCore/qlist.h, line 439
Here is my code:
if(ui->treeWidget->selectedItems().count()>0)
{
QTreeWidgetItem *i = ui->treeWidget->selectedItems().first();
i->setSelected(0);
}
Is there something wrong with my code? It looks right to me...
Added after 1 41 minutes:
It seems to me that there is something wrong with the QTreeWidget. But I'm not sure.
but when I use my code, It returns:
ASSERT failure in QList<T>::at: "index out of range", file /usr/include/qt4/QtCore/qlist.h, line 439
Here is my code:
if(ui->treeWidget->selectedItems().count()>0)
{
QTreeWidgetItem *i = ui->treeWidget->selectedItems().first();
i->setSelected(0);
}
Is there something wrong with my code? It looks right to me...
Added after 1 41 minutes:
It seems to me that there is something wrong with the QTreeWidget. But I'm not sure.