From KitwarePublic
< VTK‎ | Tutorials
Revision as of 15:31, 4 March 2013 by Daviddoria (talk | contribs) (→‎Linux: Add instructions for using the widget with QtCreator)
Jump to navigationJump to search

All systems

You must turn on the following options in the advanced VTK build configuration:

With VTK 5.x:


With VTK 6:


Note: You MUST build in Release mode.


sudo yum install qt*

(or equivalent)

Qt Designer

To use QVTKWidget in the QT4 Designer, you must:

sudo cp ~/build/VTK/bin/libQVTKWidgetPlugin.so /usr/lib/qt4/plugins/designer


sudo cp ~/build/VTK/lib/libQVTKWidgetPlugin.so /usr/lib/qt4/plugins/designer

Qt Creator

cp ~/build/VTK/bin/libQVTKWidgetPlugin.so /home/doriad/bin/qtcreator-2.6.2/bin/designer


To use Qt under LGPL, which is recommended by VTK, you have to have Debian 6.0 (Squeeze) or later. Debian(Squeeze) has QT 4.6 and Vtk 5.4 in it.

 sudo apt-get install libqt4-dev libvtk5-qt4-dev

This will install all header files and libraries that you need.

This is still recommended even if you want to build the newer version for yourself since it will install most of header files and libraries that you need to build VTK and QT. If you build your version of VTK in /usr/local (i.e VTK-5.6), you can choose which version of VTK you are using when you do cmake for your application.

Set VTK_DIR to /usr/local/lib/vtk-5.6 (your build) or /usr/lib/vtk-5.4 (system bundle) Set QT_QMAKE_EXECUTABLE to /usr/local/bin/qmake-qt4 (your build) or /usr/bin/qmake-qt4 (system bundle)

It would better match QT and VTK, that is if you build your VTK with you own QT (in /usr/local), you would better use VTK_DIR in /usr/local/lib/vtk-5.6 and QT_QMAKE_EXECUTABLE at /usr/local/bin/qmake-qt4.


Download and install Qt. http://qt.nokia.com/downloads/windows-cpp-vs2008

Add a new environment variable:

QTDIR = C:\Qt\4.X.X (or whatever path you installed QT)

Append the environment variable PATH to add

(or \bin\Debug if that is how you have built VTK)

Copy QVTKWidgetPlugin.lib and QVTKWidgetPlugin.dll from C:\bin\VTK\bin\Debug to C:\Qt\4.7.0\plugins\designer

Mac OS X 10.5

Download Qt SDK for Mac from http://get.qt.nokia.com/qtsdk/qt-sdk-mac-opensource-2010.05.dmg and install.

Download VTK Source from http://www.vtk.org/files/release/5.4/vtk-5.4.2.tar.gz.

Download VTK Data from http://www.vtk.org/files/release/5.6/vtkdata-5.6.1.tar.gz

Unpack VTK Source and Data and setup environment like described above.

make a directory to build VTK in and cd into that directory. run ccmake <VTK Source Dir> and make sure you Qt GUI is enabled. run make -j 2 and make install.

Setup environment as described above.

Using the widget

When you open QtDesigner, you will see a new title in the widget box called QVTK. Inside of it is the QVTKWidget.