Qt World Summit: Register Today!

QWebEngineView Flickers on Resize

  • Hello, I'm learning how to work with QWebEngineView, and I noticed there are large amounts of flickering. Before I report a bug, I wanted to check that I'm using it correctly with QWidgets/QMainWindow.

    #include <QtCore>
    #include <QtWidgets\QMainWindow>
    #include <QtWebEngineWidgets>
    int main( int argc, char * argv[] )
    	QApplication app( argc, argv );
    	QMainWindow mainWindow;
    	QWebEngineView *webView = new QWebEngineView;
    	webView->load( QUrl( "https://www.qt.io" ) );
    	mainWindow.setCentralWidget( webView );
    	mainWindow.resize( 800, 600 );
    	return app.exec();

    Resize Flickering Result:

    To avoid the flickering, I've tried, unsuccessfully, setting the following attributes:

    	webView->setAttribute( Qt::WA_OpaquePaintEvent, true );
    	webView->setAttribute( Qt::WA_PaintOnScreen, true );
    	webView->setAttribute( Qt::WA_DontCreateNativeAncestors, true );
    	webView->setAttribute( Qt::WA_NativeWindow, true );
    	webView->setAttribute( Qt::WA_NoSystemBackground, true );
    	webView->setAutoFillBackground( false );

    I've also tried nesting it under a QWidget object. I believe there is a delay between when the QMainWindow resizes, and when the QWebEngineView receives the resize event. I've done my best to look this up on stackoverflow/here/in the Qt documentation.

    I'm running Qt 5.7.0 on Windows 10, and it happens in both Debug and Release mode. Any thoughts?