Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Writing QImage data to a XML file using QXmlStreamWriter
QtWS25 Last Chance

Writing QImage data to a XML file using QXmlStreamWriter

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 4.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    ProudChild
    wrote on last edited by
    #1

    Im building an app in a lab that uses qt as base. We need to write an QImage data to xml file, and later on read that data, we are using QXmlStreamWriter, is there a way to write QImage as a CDATA or something like that with QXmlStreamWriter?

    thanks in advance.

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DenisKormalev
      wrote on last edited by
      #2

      I suggest you to use base64-encoded image data in xml.

      1 Reply Last reply
      0
      • P Offline
        P Offline
        ProudChild
        wrote on last edited by
        #3

        ok, where do i start? is there a way to do that with QImages?

        1 Reply Last reply
        0
        • D Offline
          D Offline
          DenisKormalev
          wrote on last edited by
          #4

          Use QImage operators >> and << to serialize to/deserialize from QByteArray (using QDataStream) and use fromBase64()/toBase64() methods of QByteArray to store data in base64.
          Please, note that operator<< of QImage will not produce valid image data, it will only provide data to use in operator>>

          1 Reply Last reply
          0
          • P Offline
            P Offline
            ProudChild
            wrote on last edited by
            #5

            [quote author="Denis Kormalev" date="1311023269"]Use QImage operators >> and << to serialize to/deserialize from QByteArray (using QDataStream) and use fromBase64()/toBase64() methods of QByteArray to store data in base64.
            Please, note that operator<< of QImage will not produce valid image data, it will only provide data to use in operator>>[/quote]

            thank you very much for your helpful insight, i would never think of that on my own!

            1 Reply Last reply
            0
            • D Offline
              D Offline
              DenisKormalev
              wrote on last edited by
              #6

              ProudChild, you are welcome :) Assistant is not a strange heap of information, it is your friend in Qt development :)

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved