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:
{
p.beginNativePainting();
glBegin(GL_QUADS);
glColor3ub(0,0,255);
glVertex2d(0, 0);
glVertex2d(0, height());
glColor3ub(255,0,0);
glVertex2d(width(), height());
glVertex2d(width(), 0);
glEnd();
qDebug() << "--- OpenGL paint" << this->width() << this->height() << p.paintEngine()->type();
p.endNativePainting();
}
void myWidget::paintEvent(QPaintEvent *e)
{
QPainter p(this);
p.beginNativePainting();
glBegin(GL_QUADS);
glColor3ub(0,0,255);
glVertex2d(0, 0);
glVertex2d(0, height());
glColor3ub(255,0,0);
glVertex2d(width(), height());
glVertex2d(width(), 0);
glEnd();
qDebug() << "--- OpenGL paint" << this->width() << this->height() << p.paintEngine()->type();
p.endNativePainting();
}
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.
Bookmarks