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. repaint() doesn't, well, repaint when the app doesn't have focus
Qt 6.11 is out! See what's new in the release blog

repaint() doesn't, well, repaint when the app doesn't have focus

Scheduled Pinned Locked Moved Solved General and Desktop
2 Posts 1 Posters 396 Views
  • 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.
  • S Offline
    S Offline
    Spaced Cowboy
    wrote on last edited by
    #1

    I have a QT app that sits waiting on a socket for commands, once it gets a command it might draw a portion of the screen into a backing image, then call repaint(x,y,w,h) to update that part of the screen.

    Except that I can see the client (running in Xcode) sending data down the socket, I can see the QT server receiving it, but nothing changes on the screen.

    Weirdly, if I then "focus" a different window (eg: the same xcode.app instance that ran the client), the QT app will update the screen, and I see the change I've sent over the socket.

    However, if I move the QT app around by the window-title-bar, it won't redraw itself.

    I tried putting a timer on the QT app's "Screen" object (the centralwidget) telling it to repaint every 1/60 of a second. but that didn't seem to make any difference.

    I'm currently using 'update()' on the "Screen" widget to repaint the area, but I tried calling 'repaint()' instead to see if there was some event issue - but that made no obvious difference either.

    This is all on a Mac, running 15.5 with the latest Xcode installed, and QT 6.9.1

    Anyone got any ideas ? I'm running dry :(

    1 Reply Last reply
    0
    • S Offline
      S Offline
      Spaced Cowboy
      wrote on last edited by
      #2

      Never mind - seems to be related to the widget being a subclass of QOpenGLWidget. If I change it to a subclass of QWidget, I get my updates just fine.

      I don't actually need QOpenGLWidget (I was just thinking it might be useful in future) so I'm good.

      1 Reply Last reply
      2
      • S Spaced Cowboy has marked this topic as solved on

      • Login

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