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. Qt6, qmake: Does 'QT += openglwidgets' imply 'QT += opengl'?
QtWS25 Last Chance

Qt6, qmake: Does 'QT += openglwidgets' imply 'QT += opengl'?

Scheduled Pinned Locked Moved Solved General and Desktop
qt6qmakepro fileopenglwidget
6 Posts 4 Posters 2.0k Views
  • 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.
  • Y Offline
    Y Offline
    Yuni
    wrote on last edited by
    #1

    In the pro file for a Qt6 project which uses the QOpenGLWidget class, it is necessary to add openglwidgets to QT (source). In practice, the project will now compile without explicitly adding opengl to QT. Does the former addition make the latter redundant, or is this not behavior that can be relied upon?

    In other words, which is the correct configuration? This:
    QT += openglwidgets
    or this:
    QT += opengl openglwidgets?

    The Qt6/OpenGL examples use QT += widgets opengl openglwidgets (source), but I cannot rule out that this for backwards compatibility with Qt5 (or earlier).

    1 Reply Last reply
    0
    • Christian EhrlicherC Online
      Christian EhrlicherC Online
      Christian Ehrlicher
      Lifetime Qt Champion
      wrote on last edited by
      #2

      If the first works why don't you simply use it. I would guess qopenglwidget.prf fetches qopengl.prf - you can take a look into them by your own.

      Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
      Visit the Qt Academy at https://academy.qt.io/catalog

      Y 1 Reply Last reply
      0
      • JoeCFDJ Offline
        JoeCFDJ Offline
        JoeCFD
        wrote on last edited by
        #3
        This post is deleted!
        1 Reply Last reply
        0
        • Christian EhrlicherC Christian Ehrlicher

          If the first works why don't you simply use it. I would guess qopenglwidget.prf fetches qopengl.prf - you can take a look into them by your own.

          Y Offline
          Y Offline
          Yuni
          wrote on last edited by
          #4

          @Christian-Ehrlicher said in Qt6, qmake: Does 'QT += openglwidgets' imply 'QT += opengl'?:

          If the first works why don't you simply use it. I would guess qopenglwidget.prf fetches qopengl.prf - you can take a look into them by your own.

          If it works and it's unspecified behavior, then it may not work on other machines or for future Qt versions.

          Excuse my ignorance, but how can I find those files? I can find 'opengl.prf' (without the 'q'), but not 'qopenglwidget.prf' (with or without the 'q'). I've tried clicking on it in Qt Creator and searching the Qt install folders.

          1 Reply Last reply
          0
          • kkoehneK Offline
            kkoehneK Offline
            kkoehne
            Moderators
            wrote on last edited by
            #5

            @Yuni said in Qt6, qmake: Does 'QT += openglwidgets' imply 'QT += opengl'?:

            If it works and it's unspecified behavior, then it may not work on other machines or for future Qt versions.

            Build and module dependencies usually don't change in a minor Qt version. For major Qt versions, things might get rearranged ... but then again there's no SC guarantee there in the first place :)

            I think it's good practice to explicitly declare all the dependencies that you explicitly rely upon though. But this is arguably a matter of taste.

            I would guess qopenglwidget.prf fetches qopengl.prf - you can take a look into them by your own.

            For QT variable, it's actually .prifiles: mkspecs/modules/qt_lib_qopenglwidgets.pri, mkspecs/modules/qt_lib_qopengl.pri ...

            Director R&D, The Qt Company

            Y 1 Reply Last reply
            1
            • kkoehneK kkoehne

              @Yuni said in Qt6, qmake: Does 'QT += openglwidgets' imply 'QT += opengl'?:

              If it works and it's unspecified behavior, then it may not work on other machines or for future Qt versions.

              Build and module dependencies usually don't change in a minor Qt version. For major Qt versions, things might get rearranged ... but then again there's no SC guarantee there in the first place :)

              I think it's good practice to explicitly declare all the dependencies that you explicitly rely upon though. But this is arguably a matter of taste.

              I would guess qopenglwidget.prf fetches qopengl.prf - you can take a look into them by your own.

              For QT variable, it's actually .prifiles: mkspecs/modules/qt_lib_qopenglwidgets.pri, mkspecs/modules/qt_lib_qopengl.pri ...

              Y Offline
              Y Offline
              Yuni
              wrote on last edited by
              #6

              @kkoehne said in Qt6, qmake: Does 'QT += openglwidgets' imply 'QT += opengl'?:

              @Yuni said in Qt6, qmake: Does 'QT += openglwidgets' imply 'QT += opengl'?:

              If it works and it's unspecified behavior, then it may not work on other machines or for future Qt versions.

              Build and module dependencies usually don't change in a minor Qt version. For major Qt versions, things might get rearranged ... but then again there's no SC guarantee there in the first place :)

              I think it's good practice to explicitly declare all the dependencies that you explicitly rely upon though. But this is arguably a matter of taste.

              I would guess qopenglwidget.prf fetches qopengl.prf - you can take a look into them by your own.

              For QT variable, it's actually .prifiles: mkspecs/modules/qt_lib_qopenglwidgets.pri, mkspecs/modules/qt_lib_qopengl.pri ...

              I see, thank you so much! I'll declare them explicitly then.

              I've found the .pri files (without the leading 'q', that is, so e.g. qt_lib_opengl.pri) and openglwidgets indeed has a dependency on opengl, explaining why the project compiles without the explicit declaration.

              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