Does anyone have a suggestion?
I have the very same problem: How do I render a QWebEngineView that has received content via QWebEngineView::setHtml().
I do not want to show the Widget.
Snippet:
QImage img(region_width, region_height, QImage::Format_ARGB32); QWebEngineView* webEngineView = new QWebEngineView(); webEngineView->resize(region_width, region_height); webEngineView->setStyleSheet("background:red"); QWebEnginePage* webEnginePage = webEngineView->page(); webEnginePage->settings()>setAttribute(QWebEngineSettings::ScreenCaptureEnabled, true); webEngineView->setHtml("<p style=\"background-color:#FFF067;color:green\"> TEXT</p>"); QPainter p(&img); webEngineView->render(&p, QPoint(0, 0), QRegion(regionSize)); p.end(); img.save("img.png", "PNG", 80);The result is always an entirely white image, regardless of the given background color, the <p> does not get rendered.