Results 1 to 2 of 2

Thread: QGLWidget based drawing in QGraphicsScene or with QGraphicsView

  1. #1
    Join Date
    Jun 2009
    Thanked 2 Times in 2 Posts
    Qt products
    Qt4 Qt/Embedded
    Unix/X11 Windows

    Default QGLWidget based drawing in QGraphicsScene or with QGraphicsView

    Hi all,

    I am adding a QGlwidget to the setviewport of QGraphicsView and by passing the window id of glwidget to a 3rd party library , it draws some graphics into the QGlwidget.

    Where i am also drawing some graphic items into the QGraphicsScene and to maintain layering (underlay/Overlay) of items , setzvalue() of graphics item is used.

    How about the graphics drawn in the QGLWidget , can it be brought in between the graphics items as underlay or overlay? Please advise.

    If not can QGLwidget can be added as a graphics item to the QGraphicsScene and can the 3rd party library can draw graphics into it ...Is it possible? So that i can maintain the layering.

    Please advise ...

  2. #2
    Join Date
    Jan 2006
    Warsaw, Poland
    Thanked 5,014 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits

    Default Re: QGLWidget based drawing in QGraphicsScene or with QGraphicsView

    You can partially control the layering mechanism by reimplementing the paint event and calling drawBackground(), drawItems() and drawForeground() manually the way you like it.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.

Similar Threads

  1. Replies: 2
    Last Post: 28th April 2012, 08:58
  2. drawing triangle with gradient based on vertices
    By marc2050 in forum Qt Programming
    Replies: 5
    Last Post: 4th August 2011, 12:45
  3. Replies: 0
    Last Post: 8th April 2010, 16:06
  4. Replies: 0
    Last Post: 29th September 2009, 02:28
  5. qglwidget not always drawing
    By spraff in forum Qt Programming
    Replies: 3
    Last Post: 24th June 2009, 19:44


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.