PDA

View Full Version : QGraphicsView performance issue



dpatel
16th July 2010, 08:50
Hi,

I am working on a application in which I have more than 500 widgets on screen. I have to add Zoom facility to view the widgets properly.
Following widgets are on UI
QDial- I have sub-classed it to override paintEvent, to paint background image. I have separate image for each QDial value
QLabel- sub-classed it, just for future use
QButton- sub-classed it, for future use
QSlider - subclasses, for future use
QPushButton - subclasses, catch mouse press and release event to color text differently.

So all the widgets that get displayed are subclass of Qt widgets.

I also have following settings for my graphics view and scene.



scene.setItemIndexMethod(QGraphicsScene::NoIndex);
view.setViewport(new QGLWidget(QGLFormat(QGL::SampleBuffers)));
view.setOptimizationFlag(QGraphicsView::DontSavePa interState);
view.setViewportUpdateMode(QGraphicsView::MinimalV iewportUpdate);
view.setWindowTitle("Peavey Surface");
view.setDragMode(QGraphicsView::ScrollHandDrag);

view.showMaximized();


Now when I zoom out, so that I can view all the widgets, the application response becomes slow. Meaning when I press and release button, I see the response after fraction of section. Its not like 2 seconds later, but definitely noticeable.

Initially I thought that its because of painting background image for the QDials, but the issue remains even after don't draw the background images.

How can I improve the performance?