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:
doc->setContent(str); file->close(); std::cout << renderer->load(barr) << std::endl; // Returns false item->setSharedRenderer(renderer); 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?
Bookmarks