Ralf Wickum
Ralf Wickum

Reputation: 3270

How to activate a QPainter::beginNativePainting , Painter inactive QGLWidget?

I got a *.dll file with follwing class signature

class Render_WidgetGL: public QGLWidget {
    Q_OBJECT
}

I created such a Render_WidgetGL object and set that to a layout object

Render_WidgetGL* renderWidget = new Render_WidgetGL(resources);
QGridLayout* gridLayout = new QGridLayout;
gridLayout->addWidget(renderWidget, 0, 1);
ui->horizontalLayout_5->addLayout(gridLayout);

When I start and execute my application I got following message:

RenderProject|nderBackendOpenGlES2|Using GLEW 1.12.0 RenderProject|nderBackendOpenGlES2|OpenGL 2.0: 1 QPainter beginNativePainting: Painter not active QPainter setRenderHint: Painter must be active to set rendering hints QPainter beginNativePainting: Painter not active QPainter beginNativePainting: Painter not active

I do not have such a Painter object in my code, so I assume it comes within the *.dll library. So how can I activate the Painter ? (By the way: The Qt docssay, that QGlWidget is obsolete)

Thnx in advance!

Upvotes: 1

Views: 2641

Answers (1)

Murat
Murat

Reputation: 736

QGLWidget has a paintEvent() which obviously uses those beginNativePainting functions - in your libraries (*.dll).

So you can replace in the *.dll beginNativePainting in that paintEvent Method:

void Render_Widget_GL::paintEvent(QPaintEvent* event){
//.. do stuff 
painter.beginNativePainting();
// .. do stuff
painter.endNativePainting();
//.. do stuff
}

.. with ... :

void Render_Widget_GL::paintEvent(QPaintEvent* event){
//.. do stuff 
painter.begin(this);
// .. do stuff
painter.end();
//.. do stuff
}

Upvotes: 1

Related Questions