我有3个列表,idList
,filmList
和songList
。从QListWidget
删除或添加项目时,也应删除其中两个列表(idList
+ filmList
或songList
)。但是,这不是问题所在。问题是,当我从列表中删除恰好8个项目时,程序崩溃了。
怎么了?
connect( removeButton, SIGNAL( clicked() ), this, SLOT( remove() ) );
//My remove function
void MainWindow::remove()
{
if( list->currentRow() != -1 ){
const unsigned int row = list->currentRow();
if( dm->remove( categoryBox->currentText(), idList.at( row ) ) )
{
idList.removeAt( row );
//Remove from specific list
if( currentCategory() == cFilm )
filmList.removeAt( row );
else if( currentCategory() == cSong )
songList.removeAt( row );
else if( currentCategory() == cApp )
;
delete list->takeItem(row);
}
}
}