Flickering when moving QGraphicsItem and using centerOn() periodically
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?