Results 1 to 6 of 6

Thread: Send a Image throw a QDataStream

  1. #1
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Send a Image throw a QDataStream

    Hi!

    About this code:
    Qt Code:
    1. QByteArray datagram;
    2. QDataStream out(&datagram, QIODevice::WriteOnly);
    3. out.setVersion(QDataStream::Qt_4_1);
    4. out << x << y << z;
    5. udpSocket->writeDatagram(datagram, QHostAddress::Broadcast, 45454);
    To copy to clipboard, switch view to plain text mode 

    I tried this with int, float, ... and it works.
    Can i load an image from the images resource into x and the send it? If so what object should i use? QImage?

    The final idea is to load the image into an object (label) in the receiver GUI.

    Thanks

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Send a Image throw a QDataStream

    You can send it directly as QImage. Look that it has redirect operators to/from QDataStream.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. The following user says thank you to wysota for this useful post:

    gt.beta2 (17th March 2009)

  4. #3
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Send a Image throw a QDataStream

    Thanks for the tip.
    You leaded me here where i found the list of suported objects: Format of the QDataStream Operators

  5. #4
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Send a Image throw a QDataStream

    If i use QDataStream::Qt_4_0 data serialization format to write data to the stream, do i have to use the same format when reading it?
    Is the some sort of compatibility?
    Thanks

  6. #5
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: Send a Image throw a QDataStream

    The docs are very clear about this, so it's best if you take a look at them. See QDataStream::setVersion().
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  7. The following user says thank you to wysota for this useful post:

    gt.beta2 (20th March 2009)

  8. #6
    Join Date
    Jan 2009
    Posts
    78
    Thanks
    21
    Thanked 1 Time in 1 Post

    Default Re: Send a Image throw a QDataStream

    I can only say

Similar Threads

  1. can Qlabel display a series of image one by one ?
    By jirach_gag in forum Qt Tools
    Replies: 3
    Last Post: 11th August 2008, 15:36
  2. Finding marks on scanned image for alignment
    By caduel in forum Qt Programming
    Replies: 1
    Last Post: 23rd September 2007, 02:10
  3. Using QDataStream
    By toratora in forum Qt Programming
    Replies: 1
    Last Post: 2nd May 2007, 15:35

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
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.