Important: Please read the Qt Code of Conduct -

DrawPixmap slower in QT 4.7.1

  • I recently updated my version of QT from 4.4.3 to 4.7.1 hoping to see an improvement in performance. Instead the drawing speed of my program got even slower. Has anyone encountered a similar issue? Any suggestions to improve performance?

    My program is drawing a scrolling image using a QGraphicsScene and one QGraphicsItem which contains the code for advancing the image. In the advance function for the QGraphicsItem, I draw onto an offscreen pixmap, and draw that pixmap to the screen in the paint function.

    Below is some sample code to give a general idea what I am trying to do:

    void MyQGraphicsItem::advance( int phase )
    pixmap_painter->drawPixmap(0, 1, offscreen_pixmap); // draw the last pixmap shifted down by one
    read in the next line of the image into a QImage of height 1 */
    pixmap_painter->drawImage(0, 0, myQImage);

    void MyQGraphicsItem::paint( QPainter *painter, const QStyleOptionsGraphicsItem * option, QWidget * widget)
    painter->drawPixmap(0, 0, *offscreen_pixmap);

    [EDIT: code formatting - please use @-tags, Volker]

  • Can you post a full testcase so it can be built and run through a profiler?

Log in to reply