VTK/Tutorials/QtSetup: Difference between revisions

From KitwarePublic
< VTK‎ | Tutorials
Jump to navigationJump to search
(Debian (squeeze) added)
Line 15: Line 15:


  sudo cp ~/bin/VTK/bin/libQVTKWidgetPlugin.so /usr/lib/qt4/plugins/designer
  sudo cp ~/bin/VTK/bin/libQVTKWidgetPlugin.so /usr/lib/qt4/plugins/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=
=Windows=

Revision as of 15:03, 3 December 2010

All systems

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

VTK_USE_QT 
VTK_USE_GUISUPPORT
BUILD_SHARED_LIBS

You MUST build in Release mode.

Linux

sudo yum install qt*

(or equivalent)

To use QVTKWidget in the QT4 Designer, you must:

sudo cp ~/bin/VTK/bin/libQVTKWidgetPlugin.so /usr/lib/qt4/plugins/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

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.