PDA

View Full Version : about QGLWidget and QPainter



showhand
17th April 2006, 10:40
hi all,

I drawed the graphics using OpenGL by QGLWidget and draw annotations with QPainter. They are overlays in sight. Now I want to save the whole image including the graphics and annotations. Is anyone has good idea for me?
ThanX a lot!

mickey
17th April 2006, 11:21
I don't understand if you want save an image of your QGLWidget....
Maybe:


QPixmap qp =WidgetGL->renderPixmap(800, 600, FALSE);
QImage qi=qp.convertToImage();
//qi = qi.smoothScale(100,100);
qi.save(base_file + ".png","PNG");

Can you help me about use QPainter on a QGLWidget?

showhand
18th April 2006, 02:16
I really don't konw if I can help you.
I wirte a class which inherits QGLWidget. I draw my graphics in OpenGL commands in my class. And I want to draw some rotation text on my graphics,but the renderText() can not help me. So I write another class inherits QWidget in which I use QPainter to draw rotation texts. Then I set the second class' parent to the first class. Now the whole image seems good for me. The background is OpenGL graphics and the foreground is the rotation texts.
I don't know how to save them to a whole image includes background and foreground.
Thank you for your helping ,but I still not solve the problems.

mickey
21st April 2006, 21:51
then I don't understand your problem

dabber
5th July 2007, 09:20
hi,all:
I want to integrate the OpenGL with the QPainter also.

The method of showhand presented is well, Can u have other approachs?

h123
12th November 2008, 10:45
can anybody please post the solution?