[Solved] QGraphicsView very fast on Mac and XP, glacially slow on Linux

  • I've developed an application using QGraphicsView, which renders map elements, using QGraphics[Ellipse,Polygon,Line]Item. There are 7500 items in the scene.

    On OS X and XP, the graphics application is very responsive. Scaling and zooming are quite snappy. However, on Linux the response is glacial. It can take a full minute after changing the scale to see the update. This has been verified on three separate Linux machines. All installations are using Qt 4.6.2.

    Any suggestions on why there would be such a discrepancy between platforms?


  • Which graphics system are you using? X11 by any chance? If so then try using the raster graphics system. To do so start your app from the command line and pass in the the -graphicssystem raster option. e.g.:

    ./myapp -graphicssystem raster

    Does that help matters?

  • If ZapB's suggestion works, you can set the QGraphicsSystem on code by calling "this method":http://doc.trolltech.com/4.6/qapplication.html#setGraphicsSystem before instantiate your QApplication.

  • Yep. You can also compile Qt such that raster is the default by configuring Qt with:

    ./configure -graphicssystem raster <other options>

  • Thanks for the tip! -graphicssytem raster did the trick. It really improved the performance.

    These are systems without direct rendering (one of them is a VMWare Fusion guest). When I do run on a system with dri supported, will I still want to use the raster graphics system?

  • It depends. Raster will give performance that mainly scales with CPU since it is entirely software based. The raster paint engine is still actively developed whereas the older X11 paint engine is not (and also has several bugs).

    If you are running on a system with hardware accelerated OpenGL support then you may be able to get even better performance by using a QGLWidget as the viewport for your QGraphicsView:

    myView->setViewPort( new QGLWidget() );

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.