Hi,<br><br>I am a newbie in VTK and Qt. For some time now,I have been trying to use VTK with Qt but faced a lot of problems getting started and configuring them. In the end, it worked(thanks to Anja Ende,Clinton Stimpson and everyone who helped me get started). I am writing down the procedure to get VTK to work with Qt in visual studio 2005 environment. Hopefully this document will help other newbies save a lot of time.
<br><br>I have tested the following procedure with MS Visual Studio 2005 Professional on Windows XP Pro X64. <br><br>1). Install and get Qt working as per the instructions here: <a href="http://qtnode.net/wiki/Qt4_with_Visual_Studio" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
http://qtnode.net/wiki/Qt4_with_Visual_Studio</a><br>This works fine and you can start using Qt with visual studio(for those who just want to use Qt with Visual Studio, this is how we do it!)<br><br>2). Install and configure VTK using Cmake with (a) VTK_USE_GUISUPPORT option and (b) VTK_USE_QVTK option, set to 'ON'
<br>If Qt is installed after VTK, you will need to reconfigure VTK to find Qt.
<br><br>3).Now it's time to test the configuration with a code which uses both Qt and VTK. You can try it with the example in VTK source( ../Examples/GUI/Qt/Imageviewer). Copy this code(only the cxx file) to a new directory.
<br><br>4) I use 'qmake' to generate build files. The method to build this example using qmake is: <br>(a) open visual studio command prompt, go to the directory containing the cxx file and type: qmake -project<br>this makes a '.pro' file. Open this file in an editor and modify it as below-
<br>----<br>######################################################################<br># Automatically generated by qmake (2.00a) Wed Oct 11 17:14:01 2006<br>######################################################################
<br><br>TEMPLATE = vcapp # this was originally 'app' modify it to 'vcapp'<br>TARGET += <br>DEPENDPATH += .<br>INCLUDEPATH += . # here include the path to all the directories containing the header files<br>LIBS += # add this line and include all the libraries(Qt and VTK) needed for the application
<br><br># Input<br>SOURCES += main.cxx<br>-----<br>(b)Save the .pro file and run qmake from the command prompt again. This will generate a '.vcproj' file. Open this file in visual studio and build it there. If you included all the libraries and include paths, this should build and run perfectly.
<br><br>I used qmake for building, because I didn't know how to do it with Cmake. But if the experts here can throw light on that it would help many. Also if someone knows of any other way(probably easier and smarter) to use Qt with VTK, please add to this document.
<br><br>Thanks,<br>Ashish<br>