Re: Double Buffering on QGLWidget - Background always grey
Hi,
I would like to do double buffering on QGLWidget. I already did that on QWidget and it worked perfectly. I have a QPixmap and i call a function, to draw some stuff to the pixmap.
Code:
func()
{
m_pixmap.fill(this, 0, 0);
painter.
setRenderHint(QPainter::Antialiasing);
painter.initFrom(this);
// drawing
In my paintEvent() function I do:
Code:
painter.
setRenderHint(QPainter::Antialiasing);
painter.drawPixmap(0, 0, m_pixmap);
But when I do this, my bachground is always grey. The OpenGL background is overpainted.
Any ideas why? And how can I fix this?
If I draw my objects in paintEvent directly it works. But I would like to draw the pixmap.
Added after 23 minutes:
Solved! I had to set the QPixmap transparent.
Code:
m_pixmap.fill(Qt::transparent);