Results 1 to 2 of 2

Thread: QOpenGLWidget: do I need this?

  1. #1
    Join Date
    Mar 2014
    Qt products
    MacOS X Unix/X11 Windows

    Default QOpenGLWidget: do I need this?

    I need to add some 3D visualisation to an existing application. It uses a QGraphicsView to display 2D graphics at the moment... Nothing too complicated, but I wanted to make it possible for users to be able to move things around, so QGraphicsView seemed the way to go.

    So I'm venturing into OpenGL for the first time for the 3D. I've read about Qt changing the way it provides access to OpenGL significantly in Qt5, and I'd like to save myself some pain down the line.

    Currently there's no QtGUI equivalent to QOpenGLWidget. It looks like it's probably coming in Qt 5.4 (I guess?). So if I want touse OpenGL in a QGraphicsView with Qt 5.2, am I stuck with the QOpenGl classes (QGLWidget in particular)? Or is there something I should be doing, like using QWidget::createWindowContainer on some widget that I then use as a viewport? Or is there a better way to future proof my software?

    Relevant details: I'm not using Qt Quick. My software needs to run on Windows, but it also runs on Mac and Linux, so if I only implement the 3D stuff in the not-Windows versions until Qt 5.4 is released, I'm ok with that.

  2. #2
    Join Date
    Jan 2006
    Graz, Austria
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Unix/X11 Windows

    Default Re: QOpenGLWidget: do I need this?

    Since you currently have a QWidget based application you could be using QGLWidget for the 3D scene and keep any normal user interface elements.

    If you want to do only GL without any interface elements, then you could be using QQuickWindow as a base.
    If your application does have user interface elements other than the 3D scene then a QQuickView might be handy.


Tags for this Thread


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.