I recently updated my Qt 4.3 to 4.6. With that said, in my QGLWidget sub class I reimplemented the paint event where a background brush was drawn using QPainter. Then I would call my OpenGL calls to draw over the background. This worked perfectly in earlier versions of Qt, but 4.6 seems to just draw over my OpenGL graphics.

I understand that the OpenGL paint system has been overhauled in this release. But I really need this functionality to work in this version and any future releases. Any help would be appreciated. Thanks.

Here is a snippet of my code.

Qt Code:
  1. class gfx : public QGLWidget
  2. {
  3. Q_OBJECT
  4. /* code */
  5. protected:
  6. void paintEvent(QPaintEvent *event);
  7. /* more code */
  8. };
  9.  
  10. static void drawBackGround(QPainter *painter)
  11. {
  12. painter->setPen(Qt::NoPen);
  13. painter->setBrush(mBackground); /* some brush for my background */
  14. painter->drawRect(rect());
  15. }
  16. void gfx::paintEvent(QPaintEvent *event)
  17. {
  18. Q_UNUSED(event)
  19. QPainter painter(this);
  20.  
  21. drawBackGround(&painter);
  22.  
  23. draw(); // openGL calls
  24. event->setAccepted(true);
  25. }
To copy to clipboard, switch view to plain text mode