Results 1 to 3 of 3

Thread: Redrawing QGLWidget with 3D+2D graphics

  1. #1
    Join Date
    Jul 2010
    Qt products
    Qt4 Qt/Embedded
    MacOS X Windows Symbian S60

    Default Redrawing QGLWidget with 3D+2D graphics


    I have a QGLWidget which draws both 3D and 2D graphics (just like in Qt's example 'overpainting').
    The thing is after I started drawing 2D graphics (moved code from paintGL() to paintEvent(), etc.), the widget stopped redrawing most of the times. It didn't redraw after resiging, after loading, and so on. I put repaint() calls, it helps in some cases, but doesn't help in e.g. resizing.
    So which function should I use to refresh the widget? update() or updateGL() or repaint()? Or maybe there is a way to set some mode to enable automatic redrawing after resizing/load/...?


  2. #2
    Join Date
    Oct 2012
    Qt products
    Unix/X11 Windows

    Default Re: Redrawing QGLWidget with 3D+2D graphics

    Hello, i'm facing the same problem and i have tried to fix it for several hours. Were you able to fix it?

  3. #3
    Join Date
    Jan 2008
    Alameda, CA, USA
    Thanked 816 Times in 805 Posts
    Qt products
    Windows Android

    Default Re: Redrawing QGLWidget with 3D+2D graphics

    Did you read the documentation for QGLWidget::paintEvent()? Did you look at the Overpainting example? Are you calling QGLWidget:aintGL() first from within your own code, and then issuing your QPainter calls? Or if your OpenGL calls are in the paintEvent itself, are you calling the OpenGL methods first before doing the overpainting? Do you call makeCurrent()? initializeGL()?

Similar Threads

  1. Error while redrawing using QPainter Class
    By sosanjay in forum Qt Programming
    Replies: 5
    Last Post: 28th December 2009, 11:48
  2. Replies: 9
    Last Post: 3rd December 2009, 18:19
  3. QGLWidget window redrawing contents when losing focus
    By Barry79 in forum Qt Programming
    Replies: 1
    Last Post: 3rd April 2009, 13:37
  4. Optimizing redrawing in the scene
    By maverick_pol in forum Qt Programming
    Replies: 4
    Last Post: 28th November 2007, 17:00
  5. subclassing or redrawing a lineEdit
    By jayw710 in forum Qt Programming
    Replies: 2
    Last Post: 7th February 2006, 18:26


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.