[vtkusers] Qt/VTK integration with VTK_QT

Simon DROUIN sdrouin at bic.mni.mcgill.ca
Thu Apr 8 11:17:07 EDT 2004


Hi Matt,

Not sure which VTK_QT you are using. I downloaded the one written by 
Matthias Koenig at:

http://wwwisg.cs.uni-magdeburg.de/~makoenig

Anyways, I compiled the 2 classes (vtkQtRenderWindow and 
vtkQtRenderWindowInteractor) and made a static library out of it. I 
compile my projects using CMake. Here is an example/template of a 
CMakeLists.txt I use:

#================================
# Beginning of example
#================================
PROJECT (ProjectName)

#================================
# Settings for Qt
#================================

INCLUDE (${CMAKE_ROOT}/Modules/FindQt.cmake)

SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${QT_DEFINITIONS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${QT_DEFINITIONS}")
INCLUDE_DIRECTORIES(${QT_INCLUDE_DIR})
LINK_DIRECTORIES(${QT_QT_LIBRARY})


SET( MY_SRC main.cpp )
SET( MY_HDR mainwindow.h )
SET( MY_GUI_SRC mainwindow.ui )

IF(QT_WRAP_UI)
  QT_WRAP_UI( ExecutableName MY_HDR MY_SRC MY_GUI_SRC )
ENDIF(QT_WRAP_UI)

LINK_LIBRARIES( ${QT_LIBRARIES} )

#================================
# Settings for VTK
#================================

INCLUDE (${CMAKE_ROOT}/Modules/FindVTK.cmake)
IF (USE_VTK_FILE)
  INCLUDE(${USE_VTK_FILE})
ENDIF (USE_VTK_FILE)

LINK_LIBRARIES( vtkHybrid vtkqt )


#================================
# Define sources
#================================
INCLUDE_DIRECTORIES(../vtkqt)
LINK_DIRECTORIES(../vtkqt)
ADD_EXECUTABLE( ExecutableName MY_SRC )

#================================
# End of example
#================================

Matt Schmiermund wrote:

>I am starting on integrating some VTK work another
>person has done with a GUI that I am developing with
>QT. I donwloaded VTK_QT as the package I was going to
>use to assist me with this, but I don't know what to
>do with the files. There is a "VTK 4.2 QMake"
>directory that has instructions for using qmake to
>build, but should I copy the contents of it into the
>direcectory VTK is in, or the directory Qt is in, or
>does it not matter?
>
>If anyone can give me any help with this or just
>general pointers for integrating the two I would
>appreciate it.
>
>-Matt Schmiermund
>_______________________________________________
>This is the private VTK discussion list. 
>Please keep messages on-topic. Check the FAQ at: <http://public.kitware.com/cgi-bin/vtkfaq>
>Follow this link to subscribe/unsubscribe:
>http://www.vtk.org/mailman/listinfo/vtkusers
>
>  
>





More information about the vtkusers mailing list