c++ - Qt- change QStringList element -
i have groupprofpic qstringlist. i'v added same photo of element
for (int k=0 ; k<4 ; ++k) groupprofpic.append(":/images/person.png");
if each person has profile picture ,default profile picture(":/images/person.png") replace his/her profile picture.
(int i=0 ; i<nicknameslist.size() ; ++i) { query1.prepare("select profpic muc_members nickname=? limit 4"); query1.addbindvalue(nicknameslist[i]); query1.exec(); if(query1.next()) { groupprofpic[i] = query1.value(0).tostring(); }
but it's not working. how fix it?
try check return value of qsqlquery::exec():
if (query1.exec()) { //do work //and see have qdebug() << "image path:" << query1.value(0).tostring(); } else { //you have error }
Comments
Post a Comment