Results 1 to 14 of 14

Thread: QDataStream and QByteArray issue

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #10
    Join Date
    Nov 2010
    Posts
    1
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11

    Default Re: QDataStream and QByteArray issue

    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.
    Last edited by magilda; 10th November 2010 at 23:32.

Similar Threads

  1. Streaming QImage (QByteArray, QDataStream, QBuffer)
    By knarz in forum Qt Programming
    Replies: 5
    Last Post: 17th January 2009, 22:05
  2. QByteArray problem
    By Misenko in forum Qt Programming
    Replies: 17
    Last Post: 4th October 2008, 21:53
  3. Reading QByteArray from QDataStream Qt3.3
    By high_flyer in forum Qt Programming
    Replies: 2
    Last Post: 1st April 2006, 20:23

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Qt is a trademark of The Qt Company.