Results 1 to 5 of 5

Thread: [qt4,win,g++] QPainter on a QGLWidget

  1. #1
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    84
    Thanks
    7
    Thanked 2 Times in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default [qt4,win,g++] QPainter on a QGLWidget

    hi,

    to draw a rubberband on a opengl widget for selection
    i want to draw a rectangle
    using qpainter in xor mode. when the painter starts painting
    the gl widget disapears suddenly and only the rectangle is shown. after
    the painter stops painting the gl widget shows up again.

    how can i draw on a OpenGL widget using qpainter? the same code
    worked in qt3 ?!

    (qrubberband does not work in this case because it's much too slow since
    the opengl widget is repainted every time the size of the rubberband is changed)

    best regards,
    jh

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: [qt4,win,g++] QPainter on a QGLWidget

    Wouldn't it be better to draw the band using OpenGL?

  3. #3
    Join Date
    Jan 2006
    Location
    Germany
    Posts
    84
    Thanks
    7
    Thanked 2 Times in 1 Post
    Qt products
    Qt3 Qt4
    Platforms
    MacOS X Unix/X11 Windows

    Default Re: [qt4.1,win,g++] Using QPainter outside paintEvent()

    would be nice if it works with qpainter as well. especially
    if it works with qt3 and one of the improvements of qt4 is
    that you can use qpainter with opengl (?!).
    btw, i suppose the problem is about painting on a widget
    outside a paintevent (s.a. my other posting) if i get a solution
    for that i guess i have a solution for the opengl problem, too.

    jh

  4. #4
    Join Date
    Jul 2008
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [qt4,win,g++] QPainter on a QGLWidget

    Hello All.
    Currently I have interest for solution of the same problem.
    I try to realize custom RubbertBand for OpenGL view on QWidget.

    Implemetation Rectangle Rubber Band - not a problem( QRegion supports rectangles -> QWidget::setMask -> good perfomance ) It is aproach from Qt original sources.
    But problem exists with Non-rectangular figures (slanting lines, for example)
    Surrounding of lines by QRegions (constructed from QPolygon ) leads to Blinking of OpenGl viewer.
    (NB. horizontal and vertical lines are not blinking! only slanting lines)

    Creating mask from QPixmap ( I try to draw Rubber Band contur by QPainter on QPixmap ) lead to very slow performans.

    Any ideas?

    Thanks in advance,
    Allender

    PS. Qt version - 4.3.3
    PPS. Drawing RubberBand in OpenGL Viewer is impossible for me, because I have two or more kind of different based on OpenGl viewers.
    Last edited by Allender; 25th July 2008 at 15:59.

  5. #5
    Join Date
    Jul 2008
    Posts
    2
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: [qt4,win,g++] QPainter on a QGLWidget

    On WindowsXP all is ok(even on Intel Graphic card), but under Mandriva 2006 still blinking.
    May be problem is too old video drivers?

Similar Threads

  1. QPainter on QGLWidget
    By h123 in forum Qt Programming
    Replies: 2
    Last Post: 17th November 2008, 13:51
  2. about QGLWidget and QPainter
    By showhand in forum Qt Programming
    Replies: 5
    Last Post: 12th November 2008, 11:45
  3. Replies: 7
    Last Post: 20th March 2006, 21:03

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.