Hello! a new noob is here ^^
I`m getting the following error as I use clear() in a QListWidget from my ui:
ASSERT failure in QList<T>::operator[]: "index out of range", file ../../QT/2010.05/qt/include/QtCore/../../src/corelib/tools/qlist.h, line 463
ASSERT failure in QList<T>::operator[]: "index out of range", file ../../QT/2010.05/qt/include/QtCore/../../src/corelib/tools/qlist.h, line 463
To copy to clipboard, switch view to plain text mode
the QListWidget is adding itens correctly, but it crashes as I try to remove them.
I tried using takeItem inside a for but the same error ocurred
Please help.
void MyDialog::on_remove_my_bt_clicked()
{
int currentIdx = ui->my_list->currentIndex().row();
if(currentIdx>-1){
listA.removeAt(currentIdx);
if(listA.size()>0){
updateMyList();
}else{
ui->my_list->clear();//<- error here
listReady = false;
}
}
}
void MyDialog::updateMyList()
{
ui->my_list->clear();//<- error here
...
}
void MyDialog::on_remove_my_bt_clicked()
{
int currentIdx = ui->my_list->currentIndex().row();
if(currentIdx>-1){
listA.removeAt(currentIdx);
if(listA.size()>0){
updateMyList();
}else{
ui->my_list->clear();//<- error here
listReady = false;
}
}
}
void MyDialog::updateMyList()
{
ui->my_list->clear();//<- error here
...
}
To copy to clipboard, switch view to plain text mode
Bookmarks