Мне надо каждому QList ImageList; присвоить определённый индекс ...Для этого я создаю QList <QList <QImage>> SourceImageList;
и в цикле пытаюсь добавить значения в этот список :
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++;
}
}
}
}
Но у меня возникает ошибка
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!
По чему таким образом SourceImageList.at(deskCount).value(countImg,shemeImg);
Не получается добавить значения в список и как это можно сделать ?
////////////////////////////////////////////////////////////////////////////////
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++;
}
}
.... Как теперь пробежаться по значениям SourceImageMap?
for (int i=0;i<SourceImageMap.take(index).size();i++)
{
SourceImageMap.take(index).take(i);
}
Так не выходит SourceImageMap.take(index).size()
всегда равен 0