PDA

View Full Version : How to sync repaint between widgets



mattia.db
3rd December 2015, 17:55
Hello,
I'm writing an application that has to visualize ten data streams from linear cameras. Each camera/stream has its own QGraphicsView, that is inside a QDockwidget. I use the vertical scrollbar of the QGraphicsView to do the playback of the streams; a QTimer is used to call the function that determines the amount of scroll. Here is the code for the scroll



foreach(LinearView * LinearView, LinearViews)
{
int Position = Odometer / LinearView->CameraStep;
if((abs(LinearView->LastPosition - Position)) > 1)
{
LinearView->VerticalScrollBar->setValue(Position);
LinearView->LastPosition = Position;
}
}

The LinearView is a QGraphicsView with little modification, I have set these flags trying to increase speed



setRenderHint(QPainter::Antialiasing, false);
setDragMode(QGraphicsView::NoDrag);
setOptimizationFlags(QGraphicsView::DontSavePainte rState);
setViewportUpdateMode(QGraphicsView::FullViewportU pdate);
setTransformationAnchor(QGraphicsView::NoAnchor);
setAttribute(Qt::WA_OpaquePaintEvent);

Now my problem is that not all the widget are updated at the same time: I have side by side more cameras with the same step, so I would expect to see them move all together; instead I see clearly that some camera moves before the others. Obviously the problem increase together with the amount of scroll done. So my question is: is there a way to forcefully sync the repaint of all the widget?
I hope to have been clear
Thanks