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. How to have a window move and repaint simultaneously?
Forum Updated to NodeBB v4.3 + New Features

How to have a window move and repaint simultaneously?

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 212 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.
  • Guy GizmoG Offline
    Guy GizmoG Offline
    Guy Gizmo
    wrote on last edited by
    #1

    I'm implementing a screen magnifier window using a QWidget-subclassed window. I have some platform specific code to grab a portion of the screen and render it to a QPixmap.

    In order for it to not render in a jittery fashion, what I then need to do is have my window move itself and repaint simultaneously.

    Currently my method is to have a timer fire at a rapid rate (around 60 times per second), and its callback function performs the screen capture, moves the window and then immediately calls repaint() right after the call to move(). This seems to do the trick, and although Qt's docs recommend against using repaint() this seems like a legitimate use case for it.

    However I'm wondering, is this the correct method? Or is there perhaps a better one?

    jsulmJ 1 Reply Last reply
    0
    • Guy GizmoG Guy Gizmo

      I'm implementing a screen magnifier window using a QWidget-subclassed window. I have some platform specific code to grab a portion of the screen and render it to a QPixmap.

      In order for it to not render in a jittery fashion, what I then need to do is have my window move itself and repaint simultaneously.

      Currently my method is to have a timer fire at a rapid rate (around 60 times per second), and its callback function performs the screen capture, moves the window and then immediately calls repaint() right after the call to move(). This seems to do the trick, and although Qt's docs recommend against using repaint() this seems like a legitimate use case for it.

      However I'm wondering, is this the correct method? Or is there perhaps a better one?

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @Guy-Gizmo said in How to have a window move and repaint simultaneously?:

      its callback function performs the screen capture

      Maybe you could do the whole screen capture once at the beginning? Then only magnify the part which your currently need.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      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