Installing OpenGL for Qt - qt

I just have installed Qt 4 on windows 7. I am now in a bit of a confusion
How do I get to install OpenGL so that it works with QT? Is there an installer for OpenGL?
Qt docs. say it has support for OpenGL, but when I include QTOpenGL and build, the compiler issues an error of "No such file or directory"
Thanks for the reply in advance!

Are you sure you followed this to the letter? You need to include <QtOpenGL> and set the QT += opengl option in your pro file.

What tool chain are you using? (Visual Studio, Qt Creator/g++) You need to specify somewhere in your project settings that you want to use the QtOpenGL module. This will result in a line in your .pro file similar to this:
QT = core gui opengl
This causes qmake to add the proper include path when invoking the compiler (I believe).

added the line QT += opengl to the .pro file

Related

I cannot integrate Qt and VTK

I am trying to integrate VTK and Qt but unfortunately for some reasons I cannot. Currently, I can run VTK's examples except those using Qt's user interface. For example, examples in tutorial work but examples in infovis cannot be run.
I followed the guide on http://www.vtk.org/Wiki/VTK/Configure_and_Build. All parts were done successfully except :
cmake -DQT_QMAKE_EXECUTABLE:PATH=/path/to/qt-4.8.6-build/qt-everywhere-opensource-src-4.8.6/bin/qmake \
-DVTK_Group_Qt:BOOL=ON \
-DBUILD_SHARED_LIBRARIES:BOOL=ON \
/path/to/VTK
when I was in VTK-build directory, it said that there was no path/to/VTK. So, I changed to VTK and removed /path/to/VTK and it worked.
Whenever I tried to build an aforementioned example, Qt says :
cannot find -lQVTK
error: cannot find -lvtkRendering ....
I really appreciate any help you can provide.
If you have installed the VTK in a folder named, say, "VTK-install", then check if you have QVTK.lib in the VTK-install/lib/vtk-5.10/ folder. (your vtk version will be different though).
In the Qt Creator, you have to edit the pro file. This is what you have to add to the end of the pro file created in Qt creator.
INCLUDEPATH += C:\\VTK\\VTK-install\\include\\vtk-5.10
LIBS += -LC:\\VTK\\VTK-install\\lib\\vtk-5.10
LIBS += -lvtkCommon\
-lvtksys\
-lQVTK\
-lvtkViews\
-lvtkWidgets\
-lvtkInfovis\
-lvtkRendering\
-lvtkGraphics\
-lvtkImaging\
-lvtkIO\
-lvtkFiltering\
-lvtklibxml2\
-lvtkDICOMParser\
-lvtkpng\
-lvtkpng\
-lvtktiff\
-lvtkzlib\
-lvtkjpeg\
-lvtkalglib\
-lvtkexpat\
-lvtkverdict\
-lvtkmetaio\
-lvtkNetCDF\
-lvtksqlite\
-lvtkexoIIc\
-lvtkftgl\
-lvtkfreetype\
-lvtkHybrid\
And run it in release mode. This should work fine.
If this doesn't work, make sure you have installed Qt and VTK correctly. You can check out this tutorial on how you should install Qt with VTK in MS Visual Studio 2010.
Install Qt with VTK
Of course, after this you got to install Qt creator which is better than Visual Studio to work with Qt.

Qt 5 Unknown module(s) in QT: uitools

I just started to use Qt today and I don't know if I did something wrong when I installed it but I can't use QFormBuilder.
Linux Xubuntu 64b
what I did:
I clone this repo : git#gitorious.org:qt/qt5.git
init_repository >> ./configure >> make >> sudo make install
I downloaded qt-creator http://qt-project.org/downloads#qt-creator
I created a new project and when I try to include QFormBuilder he tell me that he doesn't know this file.
So, I saw somewhere someone who says that I need to add QT += uitools to the project file, but now when I try to use qmake, I am getting Unknown module(s) in QT: uitools.
Sorry for my english and thank you for your help.
If you get
Project ERROR: Unknown module(s) in QT: designer
you are missing qttools5-dev package.
To add to the answer by #svlasov, on RHEL or CentOS based systems (7.x or 8.x, etc.) you need to install:
yum install qt5-qttools-devel
Depending on the project you are building, you may also need to install qt5-qttools-static.
Have you actually read the documentation?
It writes this at the beginning:
The QFormBuilder class is used to dynamically construct user interfaces from UI files at run-time. More...
Header: #include
qmake: QT += designer
Inherits: QAbstractFormBuilder.
So, just follow that and put this into your qmake project file:
QT += designer
or you can invoke qmake like this:
qmake QT += designer
Of course, you need to make sure that you have the designer installed properly for this. You will need to install a package like libqt5designer5 on your Ubuntu, or if you had installed Qt manually, you will need to install the designer manually as well.
I am not that familiar with Ubuntu. You may need to install some corresponding development package as well. Either way, the point is that the library and headers need to be installed properly on your system which you seem to lack when getting Project ERROR: Unknown module(s) in QT: designer after either of the aforementioned solutions.
Read the documentation, it says to add the designer module to the .pro file:
QT += designer

Forcing specific version of QT in .pro file

I'm searching for a way to force a specific version of QT in a .pro file. To be more specific, I'd like to force qmake to use only QT 5.x version with my project instead of QT 4.x and QT 5.x
Is there a way to do so?
PS: I'm not asking for a way to stop/halt the compile process (aka check QT version, and if lower than 5.x just throw qFatal/equivalent). I'm looking for a way to actually choose which version to use while generating the Makefile with qmake
You can throw a error if a user is running qmake with a version you do not want him to use. ex:
lessThan(QT_MAJOR_VERSION, 5): error("requires Qt 5")
I really doubt you can do this. qmake is a part of framework and goes together with libraries. When you say Qt of specific verion you mean only libraries, but it is not correct.
To use specific version of Qt, you actially need to run different version of qmake. If you are using QtCreator - you should select it in project's options, if not - type absolute path to file qmake. You can find out, which version of Qt qmake uses, you can type qmake --version.
As Amartel wrote in his answer, you should point to the correct qmake version (check it by typing qmake --version in the console)
It might be that your project has been generated using the wrong qmake executable and some files are not removed even if you issue a nmake clean or make clean.
Check that there are no Makefile in the source tree after the clean (these files will typically contain the path to the qt version to use, and if not regenerated correctly will point to the wrong Qt version).

Qt Creator 4.8.4. windows 7 - 64bit installation

I have some difficulties with QT, which I need for school for some GUI applications.
I have recently done these steps:
1) mingw-get-inst-20120426.exefrom SourceForge installed to C:\MinGW\ with default settings.
2) Qt libraries 4.8.4 for Windows (minGW 4.4, 317 MB) from QT Project installed to C:\Qt\ with default settings. Here an error occurs:
!!!There is a problem with your MinQW instalation
!!!g++ not found in c:\MinGW\bin\
!!!Do you still want to continue? Yes
I checked c:\MinGW\bin\ there is no such file
3) Qt Creator 2.6.0 for Windows (51 MB)also from QT installed to C:\Qt\gtcreator-2.6.0 with default settings
4) Run the QT IDE
5) Open project or create new project. Another error occurs here
!!!No valid kits fond.
Qt Creator uses the invalid kit Desktop to parse the project.
6) Open Options->Build & Run->Kits (But I don't know how should I set Kits and where to find them).
7) Can you also help me, how to set Qt version
(Options->Buid&Run->Qt Version)? Where do I find qmake.exe?
I also didn't find how to create GUI Application. There is no such option in New File or Project...
Thanks for help.
That is quite tricky ;)
Precompiled Qt (MinGW) is only win32 (not win64).
Precompiled Qt is compiled with MinGW-g++ 4.4 and won't work with other.
You have to download this one:
http://get.qt.nokia.com/misc/MinGW-gcc440_1.zip
//// Edit: With this version of MinGW, gdb won't work (it's not python-enabled). Although QtSDK is depracted (and you won't find it on qt-project.org), I highly recommend downloading this online installer and, during the selection of components mark only MinGW. It will come with folder named "pythongdb".
http://www.developer.nokia.com/info/sw.nokia.com/id/da8df288-e615-443d-be5c-00c8a72435f8/Qt_SDK.html
(You may need to register. It's free.)
////
Add "Compiler" by g++.exe
Add "Qt Version" by qmake.exe.
Add "Kit" with Compiler and Qt Version configured above. You can try to change debugger from CDB to GDB.
When you installed mingw, did you select the C++ compiler? It is not selected by default but you need it. Re-run the wizard and select that.
The kit is not valid because the C++ compiler cannot be found: try to install it first. If you still cannot setup this read the manual: http://doc-snapshot.qt-project.org/qtcreator-2.6/creator-targets.html. It is very complete.
qmake.exe is in *qt_directory*/bin/qmake.exe.
Try this out:
http://sourceforge.net/projects/mingw-w64/ (Since the mingw-w64 project on sourceforge.net is moving to mingw-w64.org i suggest to use mingw-w64.org)
It works for me.

Hardcoded QMAKESPEC in Qt Creator?

I installed Qt SDK (Qt framework + Qt Creator) but didn't like the layout of folders so I deleted it (without uninstalling), moved framework in one place and Qt Creator in another and installed Qt framework and Qt Creator separately placing each over the respective old one.
The problem is Qt Creator in Projects/Build Settings/Build Steps keeps showing the old path to the specification file:
-spec c:/qt/2009.03/qt/mkspecs/win32-g++
Setting QMAKESPEC environment variable either in the system or in Projects/Build Environment doesn't change anything.
How can I force Qt Creator to see and use new location of the specification file?
This does not fully solve the issue but if you add '-spec' (without quotes) in the additional arguments box in build steps -> qmake, then it removes the win32-g++ argument.
NOTE: I have NOT been able to build the project after doing this (i changed it to win32-icc and win32-msvc2008 as i have both the intel c++ compiler and VS2008) but the build fails with the error ---- "*** MIssing Separator. Stop." in the makefile
I don't have Qt Creator installed, but I suppose it may store this setting somewhere on filesystem, look in your %HOME% or %APPDATA% for directories associated with Qt Creator and search the files inside for this path.
Have you tried going into Projects->Build Settings->General and clicking on the "Manage Qt Versions" and making sure that everything there is all correct?

Resources