Hello,
I have problem with QPainter and native painting.
In short it doesn't work.

For example I use in paintEvent() this code to draw simple quad:

Qt Code:
  1. void myWidget::paintEvent(QPaintEvent *e)
  2. {
  3. QPainter p(this);
  4. p.beginNativePainting();
  5.  
  6. glBegin(GL_QUADS);
  7. glColor3ub(0,0,255);
  8. glVertex2d(0, 0);
  9. glVertex2d(0, height());
  10. glColor3ub(255,0,0);
  11. glVertex2d(width(), height());
  12. glVertex2d(width(), 0);
  13. glEnd();
  14.  
  15. qDebug() << "--- OpenGL paint" << this->width() << this->height() << p.paintEngine()->type();
  16.  
  17. p.endNativePainting();
  18.  
  19. }
To copy to clipboard, switch view to plain text mode 

paintEngine()->type() is always 10 == Rester.

So the question:
how to initialize OpenGL painting with the QPainter? (qt 4.8.1)

I don't know if it's lack of the sleep but with the 4.7. this worked fine.