I've tried it yesterday when I found it, but, it don't capture the Flash content in the WebView.
void Standalone::screenShot_VirtualScreen()
{
QImage img
(ui
->webView
->page
()->mainFrame
()->contentsSize
(),
QImage::Format_ARGB32_Premultiplied);
img.fill(Qt::transparent);
painter.
setRenderHint(QPainter::Antialiasing,
true);
painter.
setRenderHint(QPainter::TextAntialiasing,
true);
painter.
setRenderHint(QPainter::SmoothPixmapTransform,
true);
ui->webView->render(&painter);
painter.end();
img.save(screenShotPath(), "PNG");
}
void Standalone::screenShot_VirtualScreen()
{
QImage img(ui->webView->page()->mainFrame()->contentsSize(), QImage::Format_ARGB32_Premultiplied);
img.fill(Qt::transparent);
QPainter painter(&img);
painter.setRenderHint(QPainter::Antialiasing, true);
painter.setRenderHint(QPainter::TextAntialiasing, true);
painter.setRenderHint(QPainter::SmoothPixmapTransform, true);
ui->webView->render(&painter);
painter.end();
img.save(screenShotPath(), "PNG");
}
To copy to clipboard, switch view to plain text mode
It's only give me a "empty" (background-color) image, and not the content.
Bookmarks