Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Derived QGLWidget

Derived QGLWidget

Scheduled Pinned Locked Moved General and Desktop
3 Posts 2 Posters 1.3k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • S Offline
    S Offline
    swarsi
    wrote on last edited by
    #1

    Hello,

    i have a derived QGLWidget that has a lot of functionality built into it and now i want to show translucent widgets on top of the graphics scene. in following the http://doc.qt.nokia.com/qq/qq26-openglcanvas.html the actual openglscene is derived from QGraphicsScene. will i now have to rewrite the previous derived viewer class to use the functionality from QGraphicsScene or is there a better way without my having to duplicate and rewrite the previous code? in other words, is there any way for me to use my derived class directly but still be able to draw widgets on top of the scene?

    thanks for any help

    1 Reply Last reply
    0
    • D Offline
      D Offline
      DerManu
      wrote on last edited by
      #2

      The Problem I see is that QGLWidget, although often used with Graphics Views, actually is not part of the Graphics View Framework, but a standalone widget for OGL Interaction. But the convenience with proxy widgets (QGraphicsProxyWidget is what is used when embedding widgets in graphics scenes) needs the Graphics View Framework, i.e. a QGraphicsScene.

      Are you sure it's that much work involved to change from QGLWidget to QGraphicsView (which also is a QWidget after all) and use drawBackground instead of paintGL, and the scene for the widgets?

      Another Idea that will probably not work, but that's worth a try: Create a QGraphicsView and then use setViewport with an instance of your derived QGLWidget.

      1 Reply Last reply
      0
      • S Offline
        S Offline
        swarsi
        wrote on last edited by
        #3

        thanks for the reply. the first thing i thought of was your last sentence but i can see it breaking down right away so i did not pursue it. i think that i will have to replicate the code for the QGLWidget derived widget to QGraphicsScene and i hope that it is not that much work but we will see.

        1 Reply Last reply
        0

        • Login

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • Users
        • Groups
        • Search
        • Get Qt Extensions
        • Unsolved