Skip to content

Python qt3 upgrade #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 189 commits into from
Closed

Conversation

ericheim
Copy link

@ericheim ericheim commented May 6, 2015

Upgraded to PythonQt3.0 release from sourceforge. Added CMakeLists.txt for Qt4 & Qt5. TODO: Forcing Qt4.7 if Qt4.8 is present due to faulty generated 4.7 headers in the PythonQt project.

florianlink added 30 commits October 23, 2013 12:30
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@246 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
…g from these classes, since they have private destructors

git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@247 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@251 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
added std::endl

git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@252 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
added PythonQt to builtin_module_names

git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@253 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
added extra qualifier if flags are used

git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@258 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@259 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@261 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@262 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@263 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
added sorting of enums and operators to get smaller diffs in the future

git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@265 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@266 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
removed non-working and old factory example

git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@268 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@269 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@272 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
- use Py_TYPE and PyVarObject_HEAD_INIT
- added define for PyString_FromString()
- removed old-classes support for PY3K

git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@274 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@275 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
BenjaminBeney pushed a commit to BenjaminBeney/CTK that referenced this pull request Jun 29, 2015
Note that this update does NOT yet allow to build CTK with PythonQt
support using Qt5. This will be done later after commontk/PythonQt#22
and commontk#564 are integrated.

8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----
Source: http://sourceforge.net/p/pythonqt/news/2015/02/pythonqt-30-released/

PythonQt 3.0 has just been released. After three years of small
improvements on the SVN trunk, it was about time to do an official
release.

The following features have been added:

    Python 3 support
    Qt 5 support
    C++/Python ownership tracking for most of the Qt API
    better support for Pylint and jedi completion library (by e.g. implementing doc strings on slots)
    wrapping of all protected methods and protected enums
    many small improvements and bug fixes
8<----8<----8<----8<----8<----8<----8<----8<----8<----8<----

$ git shortlog e1f1c77..503597b --no-merges
Jean-Christophe Fillion-Robin (6):
      Add README file specific to CTK github fork
      Fix "_invalid_parameter_noinfo_noreturn" link error
      Update Readme.md to use new url format for svn revision reference
      Add CMake testing support
      Revert part of r91 preventing QFlags from being wrapped
      Ensure "PythonQtUtils.h" is installed when building using CMake

John Stark (1):
      Fix VS2010 compilation issue when PythonQt Debug build against python Release

Matthew Woehlke (3):
      fix problem in CMake error message
      allow specifying install directories
      remove trailing spaces in CMakeLists.txt

Steve Pieper (1):
      Fix mac build error with C standard lib macros

florianlink (149):
      made generator compile on VC11
      removed event() method from QClipboard and QWebFrame to avoid deriving from these classes, since they have private destructors
      fixed wrong inplace operator function assignment
      updated with current MeVisLab version
      replaced signals, slots and foreach with Q_* macros
      started qt5 port
      replaced emit with Q_EMIT     added std::endl
      replaced run script with direct AddObject calls     added PythonQt to builtin_module_names
      added searching super class in class hierachy
      undefine slots keyword and introduce PY3K define
      merged Qt5 port and exception parsing
      deleted unmaintained original files
      removed QNoImplicitBoolCast, it seems to be gone in Qt 5.3     added extra qualifier if flags are used
      readded linefeed
      removed qualifier again, the problem was QUrlTwoFlag<>
      Qt5 introduces new QUrl flags
      initial qt5 support
      initial qt5 support
      added typeName helper to make it behave like Qt4
      added more Qt5 specific classes     added sorting of enums and operators to get smaller diffs in the future
      adapted test to Qt5
      adapted test to Qt5, escape is gone in Qt5
      adapted examples to Qt5     removed non-working and old factory example
      renamed 4.8 bindings
      added wrapper for Qt 5.0 and 5.3
      more adaptions because of Qt 5.0
      qt5 adaptions
      auto-select pre-generated wrappers
      - started PY3K porting     - use Py_TYPE and PyVarObject_HEAD_INIT     - added define for PyString_FromString()     - removed old-classes support for PY3K
      further PY3K port
      return unicode instead on Py3
      further PY3K port
      adapted to PY3K
      upgraded to PY3K
      ported test to PY3K
      added define for debug PY3K
      fixed porting typo
      ported to PY3K
      fixed Python 2 build
      removed warnings
      added support for QtMsgType
      updated documentation
      updated to doxygen 1.8.x
      updated documentation
      added note
      added more Qt5 classes and moved some from Core to GUI
      removed phonon, which never worked     started cleanup of xml files     added sorting of fields for less diffs
      further cleanup
      removed phonon and xmlpatterns, which never worked
      removed unused files
      removed unused rules
      further cleanup
      further cleanup
      added polymorphic type ids
      fixed building of xmlpatterns
      updated 5.3 api to current generator xmls
      do not generate shell classes for classes that don't have any constructors
      added Qt multimedia     added missing flags
      reverted accidental commit
      use "__" as delimiter for nested classes
      further cleanup of typesystem, enabled some nested classes
      added support for nested classes (only one level)
      further cleanup, removed duplicate enum warning
      added missing constData()
      typesystem cleanup
      reverted
      added missing classes
      added QOpenGLPaintDevice
      added more classes
      QDataStream::ByteOrder
      added missing flags and types
      more improvements
      fixed error
      added QPersistentModelIndex
      moved generate=no to xml     added extra enum
      added more tests
      added new conversion templates
      added new QList/QVector aliases
      changed to new templates
      added support for registering QList/QVector template converters for non-pointer types that are used     register aliases for QList/QVector<enum> -> QList<int>
      added test
      changed to use last index (for nested templates like QPair)
      added new tests
      added new conversions for QList/QPair/QHash/QMap     support QMetaType::QVariant, which was added in Qt 4.8
      added more aliases
      GLuint64 may not be present, disable test for the moment
      added implicit conversion of unicode to QByteArray for PY3K
      simplified QList<Object*> conversion     added support for QList<...> and converters on Qt properties / QVariant conversion
      added more tests
      fixed compilation for Qt 4.x     register QObjectList and QList<QObject*> to allow usage in Q_PROPERTY
      updated to current generator (and added missing files)
      added newly generated wrappers
      added multimedia include
      added support for new BoolResult class to support bool* parameters
      added new source file to cmake
      changed to only map unicode to QByteArray in non-strict mode
      updated docs
      implemented polymorphic downcasting on subclasses     added better conversion of C++ to Python for virtual method overloads (and signals)
      support meta type based converters for pointer return values as well (e.g. QList<QInputEventMethod::Attribute>*), since wrapper generates * from const& return values
      added additional nested classes
      cleanup of generator     allow creation of protected non-virtuals     support protected enums that are used on protected methods     cleanup of typesystem and support removal and replacement of default args
      removed connectNotify from QClipboard to avoid promoter creation
      further typesystem cleanup
      more cleanup
      fixed name shadowing via argument index     fixed typesystem for Qt5
      updated to current generator
      removed unused code
      changed generator to use int instead of protected enums in shell and wrapper class (clang would not compile the previous approach using friend)
      updated wrappers to build on clang
      added support for size_t in properties and slots
      added support for [] mapping operators
      remoted QClipboard promoter
      fully removed QClipboard::event
      moved uitools to CONFIG for QT4     enabled xml patterns and multimedia for QT5
      using AsLongLong to allow larger Python int values to be converted to double
      fixed protected static method promotion
      fixed protected static method promotion (which in Qt 5.3 occurs only on QPixmap::fromImageInPlace())
      moved iostream include to the top, since people reported XCode6 compile problems
      added new inject-code target pywrap-operators
      improved generator to allow disabling shell and promoter creation
      special check for inventor wrappers
      remove virtual functions that are removed from the target language (why was this commented?)
      added support for additional code injection places
      added support for additional code injection places
      speedup of generator by factor 2
      added special field accessors for Inventor
      merged various improvements from MeVisLab repository     - support for properties on class wrappers     - support for return type completion on jedi library (using __doc__ of methods)     - auto importing known packages when classname appears on interface     - support of intrusive ref-counting for OpenInventor (and other ref counted libraries)     - and other small details
      fixed method promotion code when argument is named like the method
      initia$ git shortlog e1f1c77..503597b --no-merges
Jean-Christophe Fillion-Robin (6):
      Add README file specific to CTK github fork
      Fix "_invalid_parameter_noinfo_noreturn" link error
      Update Readme.md to use new url format for svn revision reference
      Add CMake testing support
      Revert part of r91 preventing QFlags from being wrapped
      Ensure "PythonQtUtils.h" is installed when building using CMake

John Stark (1):
      Fix VS2010 compilation issue when PythonQt Debug build against python Release

Matthew Woehlke (3):
      fix problem in CMake error message
      allow specifying install directories
      remove trailing spaces in CMakeLists.txt

Steve Pieper (1):
      Fix mac build error with C standard lib macros

florianlink (149):
      made generator compile on VC11
      removed event() method from QClipboard and QWebFrame to avoid deriving from these classes, since they have private destructors
      fixed wrong inplace operator function assignment
      updated with current MeVisLab version
      replaced signals, slots and foreach with Q_* macros
      started qt5 port
      replaced emit with Q_EMIT     added std::endl
      replaced run script with direct AddObject calls     added PythonQt to builtin_module_names
      added searching super class in class hierachy
      undefine slots keyword and introduce PY3K define
      merged Qt5 port and exception parsing
      deleted unmaintained original files
      removed QNoImplicitBoolCast, it seems to be gone in Qt 5.3     added extra qualifier if flags are used
      readded linefeed
      removed qualifier again, the problem was QUrlTwoFlag<>
      Qt5 introduces new QUrl flags
      initial qt5 support
      initial qt5 support
      added typeName helper to make it behave like Qt4
      added more Qt5 specific classes     added sorting of enums and operators to get smaller diffs in the future
      adapted test to Qt5
      adapted test to Qt5, escape is gone in Qt5
      adapted examples to Qt5     removed non-working and old factory example
      renamed 4.8 bindings
      added wrapper for Qt 5.0 and 5.3
      more adaptions because of Qt 5.0
      qt5 adaptions
      auto-select pre-generated wrappers
      - started PY3K porting     - use Py_TYPE and PyVarObject_HEAD_INIT     - added define for PyString_FromString()     - removed old-classes support for PY3K
      further PY3K port
      return unicode instead on Py3
      further PY3K port
      adapted to PY3K
      upgraded to PY3K
      ported test to PY3K
      added define for debug PY3K
      fixed porting typo
      ported to PY3K
      fixed Python 2 build
      removed warnings
      added support for QtMsgType
      updated documentation
      updated to doxygen 1.8.x
      updated documentation
      added note
      added more Qt5 classes and moved some from Core to GUI
      removed phonon, which never worked     started cleanup of xml files     added sorting of fields for less diffs
      further cleanup
      removed phonon and xmlpatterns, which never worked
      removed unused files
      removed unused rules
      further cleanup
      further cleanup
      added polymorphic type ids
      fixed building of xmlpatterns
      updated 5.3 api to current generator xmls
      do not generate shell classes for classes that don't have any constructors
      added Qt multimedia     added missing flags
      reverted accidental commit
      use "__" as delimiter for nested classes
      further cleanup of typesystem, enabled some nested classes
      added support for nested classes (only one level)
      further cleanup, removed duplicate enum warning
      added missing constData()
      typesystem cleanup
      reverted
      added missing classes
      added QOpenGLPaintDevice
      added more classes
      QDataStream::ByteOrder
      added missing flags and types
      more improvements
      fixed error
      added QPersistentModelIndex
      moved generate=no to xml     added extra enum
      added more tests
      added new conversion templates
      added new QList/QVector aliases
      changed to new templates
      added support for registering QList/QVector template converters for non-pointer types that are used     register aliases for QList/QVector<enum> -> QList<int>
      added test
      changed to use last index (for nested templates like QPair)
      added new tests
      added new conversions for QList/QPair/QHash/QMap     support QMetaType::QVariant, which was added in Qt 4.8
      added more aliases
      GLuint64 may not be present, disable test for the moment
      added implicit conversion of unicode to QByteArray for PY3K
      simplified QList<Object*> conversion     added support for QList<...> and converters on Qt properties / QVariant conversion
      added more tests
      fixed compilation for Qt 4.x     register QObjectList and QList<QObject*> to allow usage in Q_PROPERTY
      updated to current generator (and added missing files)
      added newly generated wrappers
      added multimedia include
      added support for new BoolResult class to support bool* parameters
      added new source file to cmake
      changed to only map unicode to QByteArray in non-strict mode
      updated docs
      implemented polymorphic downcasting on subclasses     added better conversion of C++ to Python for virtual method overloads (and signals)
      support meta type based converters for pointer return values as well (e.g. QList<QInputEventMethod::Attribute>*), since wrapper generates * from const& return values
      added additional nested classes
      cleanup of generator     allow creation of protected non-virtuals     support protected enums that are used on protected methods     cleanup of typesystem and support removal and replacement of default args
      removed connectNotify from QClipboard to avoid promoter creation
      further typesystem cleanup
      more cleanup
      fixed name shadowing via argument index     fixed typesystem for Qt5
      updated to current generator
      removed unused code
      changed generator to use int instead of protected enums in shell and wrapper class (clang would not compile the previous approach using friend)
      updated wrappers to build on clang
      added support for size_t in properties and slots
      added support for [] mapping operators
      remoted QClipboard promoter
      fully removed QClipboard::event
      moved uitools to CONFIG for QT4     enabled xml patterns and multimedia for QT5
      using AsLongLong to allow larger Python int values to be converted to double
      fixed protected static method promotion
      fixed protected static method promotion (which in Qt 5.3 occurs only on QPixmap::fromImageInPlace())
      moved iostream include to the top, since people reported XCode6 compile problems
      added new inject-code target pywrap-operators
      improved generator to allow disabling shell and promoter creation
      special check for inventor wrappers
      remove virtual functions that are removed from the target language (why was this commented?)
      added support for additional code injection places
      added support for additional code injection places
      speedup of generator by factor 2
      added special field accessors for Inventor
      merged various improvements from MeVisLab repository     - support for properties on class wrappers     - support for return type completion on jedi library (using __doc__ of methods)     - auto importing known packages when classname appears on interface     - support of intrusive ref-counting for OpenInventor (and other ref counted libraries)     - and other small details
      fixed method promotion code when argument is named like the method
      initial support for ownership handling
      added initial support for passing ownership to C++ and Python using templates as markup
      improved signature normalization
      added support for QList ownership passing
      fixed bug that was introduced by refactoring     added ownership handling for QList<SomeObject*>
      added more default arguments
      added ownership handling to central Qt classes
      fixed ugly problem with itemChange method
      regenerated wrappers for Qt 5.3 including ownership handling
      regenerated wrappers for Qt 5.0 including ownership handling
      regenerated wrappers for Qt 4.8 including ownership handling
      updated docs
      fixed compilation
      removed mapPlanes that can not be wrapped
      added Qt 5.4
      added Qt 5.4 support
      added Qt 5.4 wrappers
      removed PyQt references
      removed extra incref on PyObject* that are returned from slots. The ref-count needs to be increased by slots returning a PyObject (or by returning a new PyObject, which already has its initial ref count)
      fixed ref-counting in test
      reuse wrapper if it inherits, not only if it is the same class

texpert (1):
      Fix unused variable warning in PythonQtSlotl support for ownership handling
      added initial support for passing ownership to C++ and Python using templates as markup
      improved signature normalization
      added support for QList ownership passing
      fixed bug that was introduced by refactoring     added ownership handling for QList<SomeObject*>
      added more default arguments
      added ownership handling to central Qt classes
      fixed ugly problem with itemChange method
      regenerated wrappers for Qt 5.3 including ownership handling
      regenerated wrappers for Qt 5.0 including ownership handling
      regenerated wrappers for Qt 4.8 including ownership handling
      updated docs
      fixed compilation
      removed mapPlanes that can not be wrapped
      added Qt 5.4
      added Qt 5.4 support
      added Qt 5.4 wrappers
      removed PyQt references
      removed extra incref on PyObject* that are returned from slots. The ref-count needs to be increased by slots returning a PyObject (or by returning a new PyObject, which already has its initial ref count)
      fixed ref-counting in test
      reuse wrapper if it inherits, not only if it is the same class

texpert (1):
      Fix unused variable warning in PythonQtSlot
@AndreasFetzer
Copy link
Member

@jcfr do you think this pullrequest is ready for being merged?
We would like to include the proposed changes in MITK.

@jcfr
Copy link
Member

jcfr commented Oct 20, 2015

@AndreasFetzer Let's close this PR. There is now the patched-6 branch. See [1]

After integrating in patched-6 the recent fixes done by @msmolens on patched-5, it should be good.

[1] https://github.com/commontk/PythonQt/commits/patched-6

@AndreasFetzer
Copy link
Member

@jcfr closing the PR is ok for us. Can you estimate when the qt5 support will be integrated into ctk/PythonQt?

ericheim and others added 23 commits February 10, 2016 15:59
…s default like it's done in the qt based build system
PyObject_GetAttrString returns a new reference. PyDict_SetItemString
does not steal a reference, so Py_DECREF should be called after
PyDict_SetItemString.
This commit increments the refcount of the built-in PyInt_Type instance
when creating an enum wrapper. This is necessary because
PyTuple_SET_ITEM steals a reference to that instance.

Fixing the refcount prevents a crash when calling Py_Finalize().
…anup()

In certain situations the dealloc callback
PythonQtInstanceWrapper_dealloc is called after PythonQt::cleanup() has
been run. This can happen when Python destroys objects during
Py_Finalize(). This commit adds a check that PythonQt is still
initialized in the dealloc callback.
made name->objectName alias optional (off by default, add PYTHONQT_SUPPORT_NAME_PROPERTY to DEFINES if you need it)
added py_delete() slot support for built-in delete() method

git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@396 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
…king

added removeSignalHandlers()

git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@398 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
git-svn-id: http://svn.code.sf.net/p/pythonqt/code/trunk@399 ea8d5007-eb21-0410-b261-ccb3ea6e24a9
Prior to commit commontk@9c2e489, the "name" property was offered as an alias for the "objectName" property. Now, the alias is a compile-time option that is disabled by default.

This commit enables the "name" property alias to maintain backwards compatibility with earlier versions.
This commit prevents crashes by handling scenarios such as:
(a) object destruction after the Python interpreter has been finalized
(b) object destruction after cleanup, i.e. the singleton no longer exists

Any usage of a Qt enum demonstrates (a).

One example that demonstrates (b) is a QTimer object which is created with a
QApplication parent. PythonQt::cleanup() is called before the QApplication is
completely destroyed, so the code that handles wrapping the QTimer object must
handle the case when the PythonQt singleton no longer exists.

Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
This commit fixes a link error building PythonQtCppTests on Windows:

    1>PythonQtCppTests.obj : error LNK2001: unresolved external symbol "int __cdecl tests_PythonQtTestMain(int,char * * const)" (?tests_PythonQtTestMain@@YAHHQEAPEAD@Z)
    1>C:\temp\PythonQt-build\Debug\PythonQtCppTests.exe : fatal error LNK1120: 1 unresolved externals
A sequence of calls like the following would crash in Python when reinitializing
the interpreter the second time:

    PythonQt::init(0);
    ...
    Py_Finalize();

    PythonQt::init(0);
    ...
    Py_Finalize();
This commit changes initialization of the global storage containers to be
explicit instead of happening during static initialization. This makes the
containers properly initialized if PythonQt is initialized and cleaned up more
than once.

The motivation for this change is to support testing cleanup and finalization.
Add tests that check for clean cleanup and finalization in different scenarios.

Co-authored-by: Jean-Christophe Fillion-Robin <[email protected]>
Co-authored-by: Pat Marion <[email protected]>
This commit fixes a crash during PythonQt::cleanup(). While destroying the
PythonQtPrivate instance, any remaining PythonQtSignalReceivers that are kept
alive only by their parent object will be destroyed. The crash occurs when
PythonQtSignalReceiver's destructor calls back into
PythonQtPrivate::removeSignalEmitter() when the PythonQtPrivate instance is
mostly destroyed.

Includes test case that crashes without the fix.
@jcfr
Copy link
Member

jcfr commented Feb 18, 2016

Closing this PR. Superseded by #39

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

7 participants