VTK/Tutorials/QtSetup: Difference between revisions
Daviddoria (talk | contribs) No edit summary |
Daviddoria (talk | contribs) (→All systems: Add a note about Qt requirements.) |
||
(11 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
=All systems | =All systems= | ||
You must turn on | You must turn on the following options in the advanced VTK build configuration: | ||
With VTK 5.x: | |||
VTK_USE_QT | VTK_USE_QT | ||
VTK_USE_GUISUPPORT | VTK_USE_GUISUPPORT | ||
BUILD_SHARED_LIBS | BUILD_SHARED_LIBS | ||
With VTK 6: | |||
VTK_Group_Qt | |||
BUILD_SHARED_LIBS | |||
If your Qt was not built with Webkit, VTK_Group_Qt will complain. Instead, set VTK_Group_Qt=OFF, Module_vtkGUISupportQt=ON, and Module_vtkGUISupportQtOpenGL=ON. You must have configured Qt with -opengl (and maybe -multimedia?) or you will get a "Qt QTOPENGL library not found." CMake error when configuring VTK. | |||
Note: You MUST build in Release mode. | |||
=Linux= | =Linux= | ||
Line 13: | Line 20: | ||
(or equivalent) | (or equivalent) | ||
== Qt Designer == | |||
To use QVTKWidget in the QT4 Designer, you must: | To use QVTKWidget in the QT4 Designer, you must: | ||
sudo cp ~/bin/VTK/ | 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 | |||
NOTE: This does NOT work with versions of QtCreator built against Qt 5.0.1. At the time of this writing, the release with the package of Qt Libraries + Qt Creator is built against Qt 5.0.1, while the release of the stand alone QtCreator is built against Qt 4.8.3. The Designer plugin will simply not be loaded. | |||
=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= | ||
Download and install Qt. | Download and install Qt. | ||
http://qt.nokia.com/downloads/windows-cpp-vs2008 | 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. |
Latest revision as of 10:53, 11 May 2015
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
If your Qt was not built with Webkit, VTK_Group_Qt will complain. Instead, set VTK_Group_Qt=OFF, Module_vtkGUISupportQt=ON, and Module_vtkGUISupportQtOpenGL=ON. You must have configured Qt with -opengl (and maybe -multimedia?) or you will get a "Qt QTOPENGL library not found." CMake error when configuring VTK.
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
NOTE: This does NOT work with versions of QtCreator built against Qt 5.0.1. At the time of this writing, the release with the package of Qt Libraries + Qt Creator is built against Qt 5.0.1, while the release of the stand alone QtCreator is built against Qt 4.8.3. The Designer plugin will simply not be loaded.
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.