Stale content briefly seen in QWebEngineView upon show
-
I'm using PySide6 (but my challenge doesn't seem Python related) and I have a simple project that has a QMainWindow that contains a QWebEngineView.
The idea is to run this alongside another (non Qt) app and be able to show and hide the Qt window+browser (based on outside considerations), and when the window is shown I want to apply a new URL. It's working pretty well, except that on a subsequent show I see the previous website until the new one starts to paint.
I tried various things that didn't help, including setHtml() to set a blank HTML page before hiding or before showing, but I guess the QWebEngineView doesn't render when hidden, and event loop async stuff is probably complicating things.
I would rather the window re-appear completely white before the next webpage gets going.
As an abstract sketch, consider this sequence:
window.browser.setUrl(QUrl(SITE_ONE)) window.show()
... then later
window.hide()
... then later
window.browser.setUrl(QUrl(SITE_TWO)) window.show()
So basically at this point of the sequence, when show() is called the second time,I get a glimpse of SITE_ONE, until SITE_TWO gets to be painted.
(I suppose it's possible that it's a general widget bitmap-cache issue, not QWebEngineView specific?)