QOpenGLWidget not found in Qt version 6.3.0
-
@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 ofQOpenGLWidgets
into my class. Thats something that was not required in 5.15.1. -
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 needinitializeGL()
,paintGL()
andresizeGL()
.But that is not the problem of this topic.
-
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..
-
@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 includeQOpenGLWidget
IntelliSense show me the error that the module can not be found. So I include the whole moduleC:\Qt\6.3.0\msvc2019_64\include\QtOpenGLWidgets
to my project settings. With this I get no error message from IntelliSense. But if I deriveQOpenGLWidgets
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)"
-
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 addedopenglwidgets
only to the qmake file.A communication problem between QtVSTools and the .pro file?
-
@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.)
-
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.
-
In VC++ / Visual Studio C++
rihght Click Project - > Properties -> Qt Project settings -> QT Modules -> drop down select QT Modules and click Qt Opengl -
@AnandRathi best way