Shiboken2 and Qt Custom Widget

On Windows, I need to use several Qt5 custom widgets written in C ++ in Python, and I have to use pyside2 because of my license.

I managed to compile the pyside2 library from the source (along with shiboken2 examples), but I cannot find a simple example of how to wrap a Qt5 custom widget.

I know that pyside2 has not been officially released yet, but it seems to be already in use (for example, in Maya): In the PySide2 application, how can I get the ID for QWindow?

Can anyone give hints or directions? A minimal example would be even better.


edits

Based on @placinta's comments, I created a repo with a minimal example that tries to wrap a custom QMainWindow .

In my tests, I used the pyside2 package , which wraps Qt 5.6.

When I execute the shiboken2 , I get tons of warnings .

I assume that these warnings cause a compilation error with the shiboken2 code.

+5
source share
1 answer

The problem with my initial CMake configuration was described here here . That is, CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS has limitations, so I returned to using the "old" export headers .

However, a compilation error for the missing declaration of the metaObject() member function is still present. It works by adding the declaration manually, as the implementation is present in _wrapper.cpp . Although this is not a really satisfactory solution, it is a starting point for other users.

Qt ticket for release at https://bugreports.qt.io/browse/PYSIDE-597 .

0
source

Source: https://habr.com/ru/post/1273810/


All Articles