I cannot integrate Qt and VTK - qt

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.

Related

Build qt5.8 with desktop opengl option (ubuntu)

I built the sources of Qt5.8 with the option ./configure -opengl desktop
Then, I did a make and finally sudo make install. Now I changed the .profile file as pointed here: http://doc.qt.io/qt-5/linux-building.html
But I have a question: How can I start now qt creator ide?
It seems you're looking for qt creator, which isn't bundled in the qt sources and must be compiled separately, however if you want qt creator alongside with your new qt build, download the qt creator alone and install it, after that open the qt creator, go to Settings -> Build & Run -> Qt Versions , from there you can add new qt versions, just point to qmake which is located in your new qt installation (Probably /usr/local/qt5/bin/qmake) , now add a new kit via Kit's tab and then you can use your newly installed qt with qt creator.

Using glut with QT after update

I have a problem with update of my QT. I have decided to do an update from 5.2.1 to the newest, 5.8 version. Now I am trying to run my old project. There is something wrong with my graphic module, especially with functions connected with glut (I think so). I tried this week to solve this by myself, but now I am confused and tired.
Now I am using: Qt 5.8.0 for Windows 32-bit (MinGW 5.3.0).
Originally I had the following libs only in my .pro file, end it works in QT 5.2.1:
LIBS += -lglut
But now, in new version of QT, I am getting such errors:
Errors using the original project (with -lglut)
When I change:
LIBS += -lglut
Into:
LIBS += -lopengl32
I am getting only such errors:
Errors using -lopengl32
I do not know how to understand this "undefined reference". I see that glu.h is included in my project (as #include ). I can also see that "undefined" commands are recognized by the creator and glu.h is visible. I do not know how to solve this. Old QT 5.2.1. still is available in my computer and project successfully works. And also I have to tell You that I am not professional and I will be very grateful for any help and guidance.

How To Compile QFtp Example in Qt 5?

I have application which uses QFtp class.I have made in Qt 4 version.
But now i want to complie QFtp classe in Qt5 but it's showing some error like:
'QFtp' doesn't name and type.
how to resolve this issue. I don't want to use QNetworkAccessManager. is there any way to this?
Thank you
For the sake of completeness, the steps to use the add-ons are:
Download the sources for the add-on from https://github.com/qt/qtftp
Extract the sources somewhere (e.g. Qt5.x.y/Src/qtmyaddon)
Open a console in that folder
Read readme.txt and run the appropriate commands with the latest QT version
Run qmake
Run make (or nmake or mingw32-make or whatever)
Run sudo make install (nmake install, mingw32-make install, ...)
In the .pro file of your project, add "QT += myaddon" (e.g. "QT += ftp")
Run qmake on your project
Compile your project

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.

Libqxt under Qt Creator

I want to create a tiny app which needs global shortcuts. So, I have downloaded the current version of libqxt (0.5.1) and opened as a project in Qt Creator.
Libqxt compiles without problems in this way, so I thought that adding this in the tab Dependencies of my project it would get added automatically in the build, like Eclipse does with JAR libraries (I know that are different IDEs but it seems to be a common feature among them).
What happens? Qt Creator compiles qxt before my project, when needed, but when I want to include its headers Qt Creator keeps warning me that it cannot find them.
Probably I am missing the correct name of headers (I tried the headers showed in qxt documentation: http://doc.libqxt.org/0.5.0/classQxtGlobalShortcut.html)
By the way, I looked the code for global shortcuts and I think I can rip it out and use it in my app as is and I am going to credit qxt team and open the code of my app.
from the documentation
Add the following lines to your .pro file:
CONFIG += qxt
QXT += core gui
Note: While building the Qxt on Linux do not forget to do a sudo make install otherwise this little piece of magic may fail to work.
Qt Creator doesn't know how to expose different libraries to your projects. It's developer's duty. Dependency ensures only that mentioned projects are already built before building your main project.
Your real concern was using Qxt without proper installation. Assuming that configure have been run and libqxt have been built (using Qt Creator or manually via qmake+make), my solution is adding following snippet (with obvious QXT_DIR customization) to .pro file:
QXT_DIR = $${IN_PWD}/../libqxt-0.5.1
LIBS += -L$${QXT_DIR}/deploy/libs
INCLUDEPATH += $${QXT_DIR}/deploy/include
for(module, QXT) {
MODNAME = $$upper($$replace(module, "(.).*", "\1"))$$replace(module, "^.", "")
INCLUDEPATH += $${QXT_DIR}/deploy/include/Qxt$${MODNAME}
INCLUDEPATH += $${QXT_DIR}/src/$${module}
win32:CONFIG(debug, debug|release):MODNAME = $$join(MODNAME,,,d)
LIBS += -lQxt$${MODNAME}
}
Unfortunately I'm not sure whether it works in complex projects.
By default Qxt is built in release mode, but Qt Creator uses debug mode and it leads to broken binaries of projects depending on Qxt under Windows. You have to switch your project to release mode or build Qxt in debug mode (run configure -debug and rebuild Qxt).
Last thing: In Windows you won't be able to run your project from Qt Creator even if you successfully build it. You must copy needed Qwt*.dll files (use the d-suffix versions if you're in debug mode) from libqxt-0.5.1/deploy/libs to your_project/(release|debug) directory .

Resources