Important: Please read the Qt Code of Conduct -

RenderPixmap not behaving the same between QT 4.8 and QT 5.1

  • Hello,

    I am in the process of porting my application from QT 4.8 to QT 5.1. This is an openGL application that uses an inherited QGLWidget class similar to the hellogl example provided with the 5.1 distribution.

    See: qtbase/examples/opengl/hellogl

    I have a distribution of this application on several platforms but for right now I am working with the Linux platform openSUSE 12.3.

    My application uses the renderPixmap utility provided with the QGLWidget to generate a QPixmap of the current openGL scene.

    The problem I am having is that the renderPixmap routine is returning an empty image under QT 5.1 and not in QT 4.8

    To test this out I have changed the following routine in the hellogl example

    void Window::keyPressEvent(QKeyEvent *e)
    if (e->key() == Qt::Key_Escape)

    QPixmap glpixmap = glWidget->renderPixmap (100, 100,false );
     std::cerr<<"KeyEvent Width "<<glpixmap.width()<<" height "<<glpixmap.height()<<" depth "<<glpixmap.depth()<<" "<<std::endl;


    When this example is compiled the height width and depth of the pixmap are zero.

    Interestingly if I do the same thing with the hellogl example provided with QT 4.8 the pixmap is not empty.

    Could someone offer a suggestion as to why this is happening?



  • Lifetime Qt Champion


    This sounds like a regression. Did you check whether the is something related in the "bug report system": ?

    As a side note, please enclose your code in coding tags, it will make it readable.

  • Thanks for the reply.

    Did not know how to use the code tags sorry.

    I did a quick check on the bug report system and did not see anything related to this. I will report this problem there.

  • Lifetime Qt Champion

    Don't forget to post the link to the bug report here so other may also benefit from it :)

  • Here is the link

    "Link to the bug report I filed":

Log in to reply