I've got a QTabView that contains a QWebView that is running some JS game code in a <canvas>.
However, I'm finding that when I 'tab away' from the QWebView, it's still consuming CPU.
So, is there any way to 'pause' a QWebView, so it's not using CPU when it's not visible?
Didn't notice that, but it doesn't seem to help. I think it only stops the page loading, not a running JS app on an already loaded page.
I guess I can always navigate to a 'null' page when user tabs away, although it might be glitchy when they tab back.
Can't you make JS pause itself when mouse leaves game area? Like some of the games in miniclip?
I've already got canvas.onfocus and canvas.onblur event handlers for 'suspending' games, and this is enough for Chrome to handle tab switching.
Just tried adding window.onfocus and window.onblur handlers too but it doesn't fix QWebView.