Reputation: 2759
I'm looking for a way to take website screenshots with QWebEngineView
. The main goal is to develop a headless screencapture application that runs in the background.
I've managed to get a minimal working example to work (see this for example). However, these examples require that the QWebEngineView
widget is made visible, either with calls to QWebEngineView::show()
, QWebEngineView::showMinimized()
or even QWebEngineView::setVisible(true)
, to be able to take a screen capture of a website. As this results in opening a series of windows, this solution is less than perfect.
Does anyone know of a way to use QWebEngineView
to take screenshots of websites without having windows popping open?
Upvotes: 2
Views: 1156
Reputation: 2759
The solution is rather easy: configure the QWebEngineView
widget to not show onscreen by setting the Qt::WA_DontShowOnScreen
attribute through a call to QWidget::setAttribute(Qt::WA_DontShowOnScreen)
.
http://doc.qt.io/qt-5/qt.html#WidgetAttribute-enum
Upvotes: 3