This commit is contained in:
2018-04-23 19:55:38 +02:00
parent bc97f35058
commit 970984264e
13 changed files with 351 additions and 20 deletions
+26 -1
View File
@@ -55,6 +55,13 @@ cTextDocument* cObject::description()
return(m_lpDescription);
}
void cObject::addImage(cImage* lpImage)
{
if(m_imageList.contains(lpImage))
return;
m_imageList.append(lpImage);
}
cObject* cObjectList::add(const qint32& iID)
{
cObject* lpObject = find(iID);
@@ -79,7 +86,7 @@ cObject* cObjectList::find(const qint32& iID)
return(0);
}
bool cObjectList::load()
bool cObjectList::load(cImageList *lpImageList)
{
QSqlQuery query;
@@ -99,6 +106,24 @@ bool cObjectList::load()
lpObject->setDescription(blob2TextDocument(query.value("description").toByteArray()));
}
query.prepare("SELECT objectID, imageID FROM objectImage;");
if(!query.exec())
{
myDebug << query.lastError().text();
return(false);
}
while(query.next())
{
cObject* lpObject = find(query.value("objectID").toInt());
if(lpObject)
{
cImage* lpImage = lpImageList->find(query.value("imageID").toInt());
if(lpImage)
lpObject->addImage(lpImage);
}
}
return(true);
}