Results 1 to 6 of 6

Thread: about QGLWidget and QPainter

  1. #1
    Join Date
    Jan 2006
    Posts
    26
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Question about QGLWidget and QPainter

    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!
    There is no secret in the face of the code.

  2. #2
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: about QGLWidget and QPainter

    I don't understand if you want save an image of your QGLWidget....
    Maybe:
    Qt Code:
    1. QPixmap qp =WidgetGL->renderPixmap(800, 600, FALSE);
    2. QImage qi=qp.convertToImage();
    3. //qi = qi.smoothScale(100,100);
    4. qi.save(base_file + ".png","PNG");
    To copy to clipboard, switch view to plain text mode 
    Can you help [thread=1790]me[/thread] about use QPainter on a QGLWidget?
    Regards

  3. #3
    Join Date
    Jan 2006
    Posts
    26
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: about QGLWidget and QPainter

    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.
    There is no secret in the face of the code.

  4. #4
    Join Date
    Jan 2006
    Posts
    976
    Thanks
    53
    Qt products
    Qt3
    Platforms
    Windows

    Default Re: about QGLWidget and QPainter

    then I don't understand your problem
    Regards

  5. #5
    Join Date
    Jun 2007
    Posts
    2
    Qt products
    Qt4

    Default Re: about QGLWidget and QPainter

    hi,all:
    I want to integrate the OpenGL with the QPainter also.

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

  6. #6
    Join Date
    Aug 2008
    Posts
    60
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: about QGLWidget and QPainter

    can anybody please post the solution?

Similar Threads

  1. problem on QGLWidget and QGLFramebufferObject
    By xylosper in forum Qt Programming
    Replies: 2
    Last Post: 15th December 2008, 12:57
  2. QPainter on QGLWidget
    By h123 in forum Qt Programming
    Replies: 2
    Last Post: 17th November 2008, 13:51
  3. [qt4,win,g++] QPainter on a QGLWidget
    By jh in forum Qt Programming
    Replies: 4
    Last Post: 28th July 2008, 07:29
  4. QGLWidget, QPainter and shared contexts
    By bamboo in forum Qt Programming
    Replies: 7
    Last Post: 17th April 2007, 19:11
  5. Using QGLWidget paint engine to draw regular widgtes?
    By high_flyer in forum Qt Programming
    Replies: 11
    Last Post: 9th October 2006, 13:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.