So I'm trying to follow the code on this thread:

http://www.qtcentre.org/threads/5394...raphicsSvgItem

where the guy apparently discovered that the SVG attributes for things like color can't be changed within the QGraphicsSvgItem itself, so I need to have some kind of wrapper that holds the XML data and can edit it on the fly, then have the QSvgRenderer reload the information. The problem I am getting is that, although the renderer will load information from a file just fine, I can't get it to read from a byte array.

Here's my code snippet:

Qt Code:
  1.  
  2. QFile *file = new QFile(":/assets/outline.svg");
  3. file->open(QIODevice::ReadOnly);
  4. QTextStream *stream = new QTextStream(file);
  5. QString str = stream->readAll();
  6. doc->setContent(str);
  7. QByteArray barr = doc->toByteArray();
  8. file->close();
  9.  
  10. QSvgRenderer *renderer = new QSvgRenderer();
  11.  
  12. std::cout << renderer->load(QString(":/assets/outline.svg")) << std::endl; // Returns true
  13. std::cout << renderer->load(barr) << std::endl; // Returns false
  14.  
  15. item->setSharedRenderer(renderer);
  16.  
  17. scene->addItem(item);
To copy to clipboard, switch view to plain text mode 

(My actual code doesn't have both "renderer->load" lines in series like this. I just put them in the snippet to show what I am using.)

As the comments show, when the renderer loads the SVG straight from the file, it loads fine and I see my graphic, but when I try and load the byte array that went through the QDomDocument, I get nothing. Does anyone have any idea as to why this might be the case?