Diffstat (limited to 'noncore/graphics/drawpad/drawpadcanvas.cpp') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/graphics/drawpad/drawpadcanvas.cpp | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/noncore/graphics/drawpad/drawpadcanvas.cpp b/noncore/graphics/drawpad/drawpadcanvas.cpp index 8818c03..b8a1c2e 100644 --- a/noncore/graphics/drawpad/drawpadcanvas.cpp +++ b/noncore/graphics/drawpad/drawpadcanvas.cpp @@ -55,4 +55,5 @@ private: State m_state; ulong m_dataLenght; + QString m_dataFormat; QList<QPixmap> m_pixmaps; }; @@ -81,4 +82,9 @@ bool DrawPadCanvasXmlHandler::startElement(const QString& namespaceURI, const QS m_state = InData; m_dataLenght = atts.value("length").toULong(); + m_dataFormat = atts.value("format"); + + if (m_dataFormat.isEmpty()) { + m_dataFormat = "XPM"; + } } @@ -134,5 +140,5 @@ bool DrawPadCanvasXmlHandler::characters(const QString& ch) QImage image; - image.loadFromData((const uchar*)byteArrayUnzipped.data(), m_dataLenght, "XPM"); + image.loadFromData((const uchar*)byteArrayUnzipped.data(), m_dataLenght, m_dataFormat); QPixmap* pixmap = new QPixmap(image.width(), image.height()); @@ -216,5 +222,5 @@ void DrawPadCanvas::save(QIODevice* ioDevice) QByteArray byteArray; QBuffer buffer(byteArray); - QImageIO imageIO(&buffer, "XPM"); + QImageIO imageIO(&buffer, "PNG"); buffer.open(IO_WriteOnly); @@ -227,5 +233,5 @@ void DrawPadCanvas::save(QIODevice* ioDevice) ::compress((uchar*)byteArrayZipped.data(), &size, (uchar*)byteArray.data(), byteArray.size()); - textStream << " <data length=\"" << byteArray.size() << "\">"; + textStream << " <data length=\"" << byteArray.size() << "\" format=\"PNG\">"; static const char hexchars[] = "0123456789abcdef"; |