VTK/Tutorials/QtSetup: Difference between revisions
Daviddoria (talk | contribs) (→Linux: I'm not sure if in VTK5 libQVTKWidgetPlugin.so was really in vtk/bin (versus vtk/lib), but in VTK6 it is definitely in /lib) |
Daviddoria (talk | contribs) (→Linux: Add instructions for using the widget with QtCreator) |
||
Line 18: | Line 18: | ||
(or equivalent) | (or equivalent) | ||
== Qt Designer == | |||
To use QVTKWidget in the QT4 Designer, you must: | To use QVTKWidget in the QT4 Designer, you must: | ||
Line 24: | Line 25: | ||
VTK6: | VTK6: | ||
sudo cp ~/build/VTK/lib/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 | |||
=Linux(Debian)= | =Linux(Debian)= |
Revision as of 15:31, 4 March 2013
All systems
You must turn on the following options in the advanced VTK build configuration:
With VTK 5.x:
VTK_USE_QT VTK_USE_GUISUPPORT BUILD_SHARED_LIBS
With VTK 6:
VTK_Group_Qt BUILD_SHARED_LIBS
Note: You MUST build in Release mode.
Linux
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
VTK6:
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
Linux(Debian)
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.
Windows
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
C:\Qt\4.X.X\bin C:\VTKbuild\bin\Release (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.