[Qt-interest] dynamically generated SVG inside a QWebView?
Paul Miller
paul at fxtech.com
Sun May 31 15:06:05 CEST 2009
Karol Krizka wrote:
> On Fri, May 29, 2009 at 9:28 PM, Paul Miller <paul at fxtech.com> wrote:
>> I want to use a QWebView to show some SVG content that is dynamically
>> generated from data within my application (a chart).
>>
>> I see that I can't embed svg directly in my content using <svg>
>> elements, but if I embed an <object> element that references SVG data
>> that will work. However, the data is coming from a file and I need the
>> data to come from code generated on the fly in my application.
>>
>> Is it possible to wedge in my own data generator so the svg does not
>> have to live as a file on disk first?
>>
>> I'm using Qt 4.5.1.
>>
> Do you have to use QWebView to show the data? If not, you might want
> to take a look at QSvgWidget, which has a function to load the SVG
> image from data stored in QByteArray.
I thought about that, but if I embed the widget in the web page (as a
plugin) then I can't print it (there is more in the document than just svg).
What I ended up doing is using an <img> tag that referenced the svg, and
I just generate the svg data as a temporary file before generating my
report. It's kind of a kludge (I wanted to avoid writing any files). It
would be nice if QWebPage had a way to override the query of the image
so I could generate it on the fly, but this will work.
--
Paul Miller | paul at fxtech.com | www.fxtech.com | Got Tivo?
More information about the Qt-interest-old
mailing list