Hello to everybody,
hoping to be helpful and to learn from everybody.
m.
Added after 1 20 minutes:
Thanks for your code,
I send you my revised version for POstgresql
inserting :
void lbytea()
{
QByteArray qba;
QImage pix("/home/pgsql/loaddir/motrice_30.png","PNG");
QBuffer buffer(&qba);
buffer.open(QIODevice::WriteOnly);
pix.save(&buffer,"PNG");
QSqlQuery insertPicCom;
insertPicCom.prepare("insert into pix (sch,pixyb) values(:sch,ixyb)");
qba=qba.toHex();
insertPicCom.bindValue(":sch","PIPPO");
insertPicCom.bindValue("ixyb",qba);
insertPicCom.exec();
}
retriving
qstrpix="select anf_pixyb from anf_flotta where anf_idmezzo = ...
QSqlQuery qpix(qstrpix);
if (qpix.next()) {
qba = qpix.value(0).toByteArray();
qba=QByteArray::fromHex(qba);
QPixmap dixy;
dixy.loadFromData ( qba);
qwh->setIcon(QIcon(dixy));
}
m.![]()
Bookmarks