I need every QList ImageList; assign a specific index ... To do this, I create a QList <QList <QImage>> SourceImageList; and in the loop I try to add values to this list:
if (QueryDesk->exec("SELECT desk_id,name_desk FROM tank.desk WHERE ship_id = 3")) { int deskCount = 0; while (QueryDesk->next()) { if (QueryDeckLayout->exec(QString("SELECT url,name FROM tank.deck_layout WHERE desk_id = %1").arg(QueryDesk->value(0).toString()))) { int countImg=0; while (QueryDeckLayout->next()) { SourceImageList.at(deskCount).value(countImg,shemeImg); countImg++; } } } } But I get an error
ASSERT failure in QList<T>::at: "index out of range", file C:\Qt\5.11.0\msvc2017_64\include\QtCore/qlist.h, line 541 Debug Error! This is why SourceImageList.at(deskCount).value(countImg,shemeImg); Can't add values to the list and how can this be done? ////////////////////////////////////////////////// //////////////////////////////
if (QueryDesk->exec("SELECT desk_id,name_desk FROM tank.desk WHERE ship_id = 3")) { int deskCount = 0; while (QueryDesk->next()) { if (QueryDeckLayout->exec(QString("SELECT url,name FROM tank.deck_layout WHERE desk_id = %1").arg(QueryDesk->value(0).toString()))) { int countImg=0; while (QueryDeckLayout->next()) { QImage shemeImg; shemeImg.load(FI.absoluteFilePath()); tempSourceImageMap.insert(countImg,shemeImg); countImg++; } SourceImageMap.insert(tankCount,tempSourceImageMap); } deskCount++; } } .... How can I run through the SourceImageMap values now?
for (int i=0;i<SourceImageMap.take(index).size();i++) { SourceImageMap.take(index).take(i); } So SourceImageMap.take(index).size() does not always equal 0