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. QOpenGLWidget not found in Qt version 6.3.0

QOpenGLWidget not found in Qt version 6.3.0

Scheduled Pinned Locked Moved Solved General and Desktop
17 Posts 7 Posters 8.7k 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.
  • M Offline
    M Offline
    makopo
    wrote on 6 Jul 2022, 11:32 last edited by makopo 7 Jun 2022, 11:33
    #1

    Hi eveybody,

    I'am very confused because it is not possible to integrateQOpenGLWidget into one of my classes.

    As described in the docs I have to include the QOpenGLWidget into the corresponding class and add qopenglwidgets to my .pro file.
    The QT topic in my project file look like this: QT += core gui opengl openglwidgets

    QOpenGLWidget is included like this:

    #pragma once
    #include <QObject>
    #include <QWidget>
    #include <QOpenGLWidget>
    #include <QOpenGLFunctions>
    
    class ClassName : public QOpenGLWidget, protected QOpenGLFunctions
    

    With QOpenGLFunctions there are no problems. I'am using version 6.3.0., with version 5.15.1 it works.

    Any hints?

    J 1 Reply Last reply 6 Jul 2022, 12:03
    0
    • M makopo
      6 Jul 2022, 11:32

      Hi eveybody,

      I'am very confused because it is not possible to integrateQOpenGLWidget into one of my classes.

      As described in the docs I have to include the QOpenGLWidget into the corresponding class and add qopenglwidgets to my .pro file.
      The QT topic in my project file look like this: QT += core gui opengl openglwidgets

      QOpenGLWidget is included like this:

      #pragma once
      #include <QObject>
      #include <QWidget>
      #include <QOpenGLWidget>
      #include <QOpenGLFunctions>
      
      class ClassName : public QOpenGLWidget, protected QOpenGLFunctions
      

      With QOpenGLFunctions there are no problems. I'am using version 6.3.0., with version 5.15.1 it works.

      Any hints?

      J Offline
      J Offline
      jsulm
      Lifetime Qt Champion
      wrote on 6 Jul 2022, 12:03 last edited by
      #2

      @makopo What is the exact error?
      Did you try a complete rebuild after editing pro file:

      1. Delete build folder
      2. Run qmake
      3. Build

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      M 1 Reply Last reply 6 Jul 2022, 12:28
      0
      • J jsulm
        6 Jul 2022, 12:03

        @makopo What is the exact error?
        Did you try a complete rebuild after editing pro file:

        1. Delete build folder
        2. Run qmake
        3. Build
        M Offline
        M Offline
        makopo
        wrote on 6 Jul 2022, 12:28 last edited by makopo 7 Jun 2022, 13:01
        #3

        @jsulm

        I'am using Visual Studio 2019 . The error message is: C1083: Cannot open filetype file: 'QOpenGLWidget': message. No such file in directory.

        Deleting the build folder and rebuild the program did not solve the issue.

        EDIT: I can include the QOpenGLWidget on this way: #include <QtOpenGLWidgets/QOpenGLWidget>. But than I get 14 horrible linker error messages, depending on the OpenGL Widget.

        1 Reply Last reply
        0
        • J Offline
          J Offline
          JoeCFD
          wrote on 6 Jul 2022, 13:36 last edited by JoeCFD 7 Jun 2022, 13:43
          #4

          try to add widgets?
          QT += core gui opengl widgets openglwidgets

          in Qt5, QOpenGLWidget in module widgets. in Qt6 it is moved to openglwidgets. But you still need widgets module.

          M 1 Reply Last reply 6 Jul 2022, 14:38
          0
          • J JoeCFD
            6 Jul 2022, 13:36

            try to add widgets?
            QT += core gui opengl widgets openglwidgets

            in Qt5, QOpenGLWidget in module widgets. in Qt6 it is moved to openglwidgets. But you still need widgets module.

            M Offline
            M Offline
            makopo
            wrote on 6 Jul 2022, 14:38 last edited by
            #5

            @JoeCFD said in QOpenGLWidget not found in Qt version 6.3.0:

            try to add widgets?

            I added it, but it changed nothing. I also understand the difference between the versions, but it still not work.

            Its also possible to use #include QOpenGLWidget if you add the folder of the module, thats located in the include-directory, to the include path of VC++ in the project settings of Visual Studio.

            A curious thing: If I derive my class from QOpenGLWidgets it looks like that it is necessary to implement all methods of QOpenGLWidgets into my class. Thats something that was not required in 5.15.1.

            1 Reply Last reply
            0
            • J Offline
              J Offline
              JoeCFD
              wrote on 6 Jul 2022, 14:42 last edited by JoeCFD 7 Jun 2022, 14:44
              #6

              Go check the include path in the make file. If the include path of module openglwidgets is not there, there must be a bug in the qt plugin for VS. You can add its include path in your VS project manually.

              M 1 Reply Last reply 6 Jul 2022, 15:57
              0
              • J JoeCFD
                6 Jul 2022, 14:42

                Go check the include path in the make file. If the include path of module openglwidgets is not there, there must be a bug in the qt plugin for VS. You can add its include path in your VS project manually.

                M Offline
                M Offline
                makopo
                wrote on 6 Jul 2022, 15:57 last edited by makopo 7 Jun 2022, 15:58
                #7

                @JoeCFD

                I had added the include path in the project settings like this: C:\Qt\6.3.0\msvc2019_64\include\QtOpenGLWidgets. And after that it works with #include <QOpenGLWidget>.

                The problem now is that I have to implement ALL protected functions of QOpenGLWidget, although I only need initializeGL(), paintGL() and resizeGL().

                But that is not the problem of this topic.

                J 1 Reply Last reply 6 Jul 2022, 16:14
                0
                • M makopo
                  6 Jul 2022, 15:57

                  @JoeCFD

                  I had added the include path in the project settings like this: C:\Qt\6.3.0\msvc2019_64\include\QtOpenGLWidgets. And after that it works with #include <QOpenGLWidget>.

                  The problem now is that I have to implement ALL protected functions of QOpenGLWidget, although I only need initializeGL(), paintGL() and resizeGL().

                  But that is not the problem of this topic.

                  J Offline
                  J Offline
                  JoeCFD
                  wrote on 6 Jul 2022, 16:14 last edited by
                  #8

                  @makopo check the definitions of these functions in QOpenGLWidget.h to see if they have = 0 at the end; if yes, you have to do it.

                  M 1 Reply Last reply 6 Jul 2022, 16:21
                  0
                  • J JoeCFD
                    6 Jul 2022, 16:14

                    @makopo check the definitions of these functions in QOpenGLWidget.h to see if they have = 0 at the end; if yes, you have to do it.

                    M Offline
                    M Offline
                    makopo
                    wrote on 6 Jul 2022, 16:21 last edited by
                    #9

                    @JoeCFD

                    I checked it. It is not necessary to implement all methods of this class.

                    I'am not sure if this problem is a problem of the project setting, Qt VS Tools or version 6.3.0. Because I'am a beginner, I'am sitting the half day on this problem..

                    JonBJ 1 Reply Last reply 6 Jul 2022, 16:30
                    0
                    • M makopo
                      6 Jul 2022, 16:21

                      @JoeCFD

                      I checked it. It is not necessary to implement all methods of this class.

                      I'am not sure if this problem is a problem of the project setting, Qt VS Tools or version 6.3.0. Because I'am a beginner, I'am sitting the half day on this problem..

                      JonBJ Offline
                      JonBJ Offline
                      JonB
                      wrote on 6 Jul 2022, 16:30 last edited by
                      #10

                      @makopo
                      You should not have to implement a method just because the base is protected. Perhaps show what error makes you say this?

                      1 Reply Last reply
                      0
                      • M Offline
                        M Offline
                        makopo
                        wrote on 6 Jul 2022, 17:12 last edited by makopo 7 Jun 2022, 17:12
                        #11

                        @JonB said in QOpenGLWidget not found in Qt version 6.3.0:

                        You should not have to implement a method just because the base is protected

                        I know that. My problem is that this is the opinon of Visual Studio (or IntelliSense). I get error with the error code E1696 and C1083.

                        Let my explain what I had done:

                        I had created a Qt project with the Qt Widgets Application template. I setup the include-directory and library-directory in the project settings. I also add the library to the linker.

                        I add QT += core gui widgets opengl openglwidgets to the .pro/qmake file.

                        With this setup I can include the modules QObject, QWidget, QDebug, QPainter, QOpenGLFunctions. When I include QOpenGLWidget IntelliSense show me the error that the module can not be found. So I include the whole module C:\Qt\6.3.0\msvc2019_64\include\QtOpenGLWidgets to my project settings. With this I get no error message from IntelliSense. But if I derive QOpenGLWidgets to implement the three protected functions of the class I get Linker errors according to the "reimplemented protected functions" and it looks like that the implementation is required.
                        These errors look like:
                        LNK2001 Nicht aufgelöstes externes Symbol ""protected: virtual bool __cdecl QOpenGLWidget::event(class QEvent *)" (?event@QOpenGLWidget@@MEAA_NPEAVQEvent@@@Z)"

                        1 Reply Last reply
                        0
                        • M Offline
                          M Offline
                          makopo
                          wrote on 6 Jul 2022, 17:33 last edited by makopo 7 Jun 2022, 17:34
                          #12

                          I solved it.

                          I checked the Qt project settings in Visual Studio and found that openglwidgets was not added to the QtModules section.
                          Befor I realize that I added openglwidgets only to the qmake file.

                          A communication problem between QtVSTools and the .pro file?

                          J S 2 Replies Last reply 6 Jul 2022, 19:04
                          0
                          • M makopo
                            6 Jul 2022, 17:33

                            I solved it.

                            I checked the Qt project settings in Visual Studio and found that openglwidgets was not added to the QtModules section.
                            Befor I realize that I added openglwidgets only to the qmake file.

                            A communication problem between QtVSTools and the .pro file?

                            J Offline
                            J Offline
                            JoeCFD
                            wrote on 6 Jul 2022, 19:04 last edited by
                            #13

                            @makopo Good for you. Now I remember there is a step to select modules in the plugin. Is this step really needed? not sure.

                            1 Reply Last reply
                            0
                            • M makopo
                              6 Jul 2022, 17:33

                              I solved it.

                              I checked the Qt project settings in Visual Studio and found that openglwidgets was not added to the QtModules section.
                              Befor I realize that I added openglwidgets only to the qmake file.

                              A communication problem between QtVSTools and the .pro file?

                              S Offline
                              S Offline
                              SimonSchroeder
                              wrote on 7 Jul 2022, 07:13 last edited by
                              #14

                              @makopo said in QOpenGLWidget not found in Qt version 6.3.0:

                              A communication problem between QtVSTools and the .pro file?

                              There is no communication between Visual Studio and the .pro file. If you change the .pro file you have to recreate the VS project file. (At least, this has always been my understanding and I started using qmake to create the VS project file, as the VS Qt plugin is (used to be???) terrible.)

                              M 1 Reply Last reply 13 Jul 2022, 12:18
                              0
                              • S SimonSchroeder
                                7 Jul 2022, 07:13

                                @makopo said in QOpenGLWidget not found in Qt version 6.3.0:

                                A communication problem between QtVSTools and the .pro file?

                                There is no communication between Visual Studio and the .pro file. If you change the .pro file you have to recreate the VS project file. (At least, this has always been my understanding and I started using qmake to create the VS project file, as the VS Qt plugin is (used to be???) terrible.)

                                M Offline
                                M Offline
                                makopo
                                wrote on 13 Jul 2022, 12:18 last edited by makopo
                                #15

                                @SimonSchroeder

                                Many thanks for your advice! I got the same problems as descriped in my first post, after I had created a new class file in VS and include Qt Widget. After that I got errors in ALL my classes, that include Qt modules. I recreate the VS project and that helps to fix the issue.

                                I think your advice is the right way to troubleshoot this.

                                1 Reply Last reply
                                0
                                • A Offline
                                  A Offline
                                  AnandRathi
                                  wrote on 12 Oct 2024, 13:02 last edited by AnandRathi 10 Dec 2024, 13:02
                                  #16

                                  In VC++ / Visual Studio C++
                                  rihght Click Project - > Properties -> Qt Project settings -> QT Modules -> drop down select QT Modules and click Qt Opengl

                                  J 1 Reply Last reply 31 Oct 2024, 14:48
                                  0
                                  • A AnandRathi
                                    12 Oct 2024, 13:02

                                    In VC++ / Visual Studio C++
                                    rihght Click Project - > Properties -> Qt Project settings -> QT Modules -> drop down select QT Modules and click Qt Opengl

                                    J Offline
                                    J Offline
                                    juejuezi
                                    wrote on 31 Oct 2024, 14:48 last edited by
                                    #17

                                    @AnandRathi best way

                                    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