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. Flickering when moving QGraphicsItem and using centerOn() periodically
QtWS25 Last Chance

Flickering when moving QGraphicsItem and using centerOn() periodically

Scheduled Pinned Locked Moved General and Desktop
qgraphicsitemqt5.5qgraphicssceneqglwidgetupdateviewport
1 Posts 1 Posters 1.2k 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.
  • M Offline
    M Offline
    Mick
    wrote on last edited by
    #1

    Dear all,

    I'm using a QGraphicsScene with some items. One of them (player) is movable with arrow keys, done by player->setPos(..). Since the Scene is quite large, this item is always kept centered by calling view->ensureVisibility(player) and view->centerOn(player) with some signals and slots after moving.

    Now the problem is, that the automatic viewportupdate sometimes updates right after the player has moved and again after he was focused. This results in some kind of flickering (The player is kind of jumping forward and backward). Is there a way to prevent this from happening?

    Since I want to use at least some hardware acceleration I use view->setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));. Disabling automatic updates by view->setViewportUpdateMode(ViewportUpdateMode::NoViewportUpdate) and calling view->viewport()->update() manually would result in cpu rendering (I think!?!). Is there a way to call the OpenGL rendering methods manually in this way?

    Does anybody know a solution to this problem?
    Thanks alot!

    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