Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Pause QWebView...?
Qt 6.11 is out! See what's new in the release blog

Pause QWebView...?

Scheduled Pinned Locked Moved General and Desktop
5 Posts 2 Posters 1.6k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    marksibly
    wrote on last edited by
    #1

    Hi,

    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?

    Bye!
    Mark

    1 Reply Last reply
    0
    • B Offline
      B Offline
      b1gsnak3
      wrote on last edited by
      #2

      QWebView::stop()

      1 Reply Last reply
      0
      • M Offline
        M Offline
        marksibly
        wrote on last edited by
        #3

        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.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          b1gsnak3
          wrote on last edited by
          #4

          Can't you make JS pause itself when mouse leaves game area? Like some of the games in miniclip?

          1 Reply Last reply
          0
          • M Offline
            M Offline
            marksibly
            wrote on last edited by
            #5

            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.

            1 Reply Last reply
            0

            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • Users
            • Groups
            • Search
            • Get Qt Extensions
            • Unsolved