[webkit-qt] Streaming input for a snapshot

Aris van Dijk arisvd at gmail.com
Wed May 26 03:35:19 PDT 2010


I've a question about how to use stdin to pass streaming HTML and render a
snapshot of it. I'm trying to alter the 'webcapture' program such that it
works for me. However, my knowledge of c++ is too limited to complete :(.
Could anyone help me with this? I have the following code:

    QByteArray input;
    QBuffer buffer(&input);
    QDataStream in(&buffer);
    in << std::cin;

After that I would like to use the QByteArray input to load a QWebFrame:

QWebPage m_page;
m_page.mainFrame()->setContent(input, QString("application/xhtml+xml"),
baseUrl); //or "text/html"

However, the program doesn't seem to work; it seems the input is empty and
the program does not exit. What am I doing wrong?

Moreover, I would like to stream the rendered QImage image to stdout as
well. Would the code be something like this?:

QImage image; //some image that was rendered to
QBuffer buffer;
QDataStream out(&buffer);
image.save(&buffer, "PNG"); // writes image into the buffer in PNG format
std::cout << in;

Or are there more efficient ways to get a streaming result?

Thanks in advance,

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.webkit.org/pipermail/webkit-qt/attachments/20100526/428f00c4/attachment.html>

More information about the webkit-qt mailing list