[vtkusers] PyQt and VTK - Qt version number

Jeff Baumes jeff.baumes at kitware.com
Wed Nov 3 15:11:54 EDT 2010


This may or may not be related to the recent post about PyQt and VTK, but I
thought I'd start it in a different thread. I've also had trouble compiling
VTK with VTK_WRAP_PYTHON_SIP. GUISupport/Qt/CMakeLists.txt assumes that the
"-t" flag sent to sip should match the current Qt version. But from what I
could find online, the "-t" flag does not correspond to the Qt version, but
the API version that is being wrapped with sip. The actual value that should
be used for the "-t" flag seems to be in PyQt's pyqtconfig.py:

# These are installation specific values created when PyQt4 was configured.
_pkg_config = {
    'pyqt_bin_dir':
 '/System/Library/Frameworks/Python.framework/Versions/2.6/bin',
    'pyqt_config_args':  '',
    'pyqt_mod_dir':      '/Library/Python/2.6/site-packages/PyQt4',
    'pyqt_modules':      'QtCore QtGui QtHelp QtMultimedia QtNetwork
QtOpenGL QtScript QtScriptTools QtSql QtSvg QtTest QtWebKit QtXml
QtXmlPatterns phonon QtDesigner',
    'pyqt_sip_dir':
 '/System/Library/Frameworks/Python.framework/Versions/2.6/share/sip/PyQt4',
    'pyqt_sip_flags':    '-x VendorID -t WS_MACX -x PyQt_NoPrintRangeBug -t
Qt_4_6_3 -x Py_v3 -g',
    'pyqt_version':      0x040704,
    'pyqt_version_str':  '4.7.4',
    'qt_data_dir':       '/usr/local/Qt4.7',
    'qt_dir':            '/',
    'qt_edition':        'free',
    'qt_framework':      1,
    'qt_inc_dir':        '/usr/include',
    'qt_lib_dir':        '/Library/Frameworks',
    'qt_threaded':       1,
    'qt_version':        0x040700,
    'qt_winconfig':      'shared'
}

Note the mismatch between the pyqt_sip_flags and pyqt_version_str. When I
applied the following patch to explicitly set the flag to what is in
pyqt_sip_flags, it worked with no errors:

--- a/GUISupport/Qt/CMakeLists.txt
+++ b/GUISupport/Qt/CMakeLists.txt
@@ -279,7 +279,8 @@ if(VTK_WRAP_PYTHON_SIP)
   elseif(Q_WS_MAC)
     set(SIP_FLAGS ${SIP_FLAGS} -t WS_MACX)
   endif()
-  set(SIP_FLAGS ${SIP_FLAGS} -t
Qt_${QT_VERSION_MAJOR}_${QT_VERSION_MINOR}_0)
+  set(SIP_FLAGS ${SIP_FLAGS} -t Qt_4_6_3)
   set(SIP_FLAGS ${SIP_FLAGS}
     -I ${SIP_PYQT_DIR}
     -I ${CMAKE_CURRENT_SOURCE_DIR}

Anyone know why this mismatch exists? Should the CMakeLists file somehow
extract this from pyqtconfig.py instead of assuming the versions match?

Jeff
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.vtk.org/pipermail/vtkusers/attachments/20101103/d09a9fb7/attachment.htm>


More information about the vtkusers mailing list