Important: Please read the Qt Code of Conduct -

Need help with sip to create a PyQt5 wrapper for a C++ object that inherits from QWidget.

  • I'm trying to create a PyQt5 wrapper for a C++ object that inherits from QWidget.
    All the documentation that I can find seems to be either out of date or incomplete.
    Platform is Windows.
    I'm using Python version 3.9.2
    I have done
    pip install PyQt5 # version 5.15.2
    pip install sip # version 6.0.3

    I have downloaded source for Qt5.15.2 and compiled it.
    In C++ I have created an object that inherits from QWidget.
    I have compiled this object to a .dll and have the corresponding .lib

    I have created a sip file for this widget.
    I have created pyproject.toml file.

    When I run sip-build I see output:
    sip-build: ::QWidget has not been defined

    I don't know what file sip-build desires for a definition of QWidget. A .sip, .h, .lib.
    I have attempted to place paths to all of these files in pyproject.toml.

    I have looked at the project here:
    python reports
    No module named 'sipconfig', leading me to believe this is outdated.
    The project also does not have pyproject.toml file.

    I have followed the official sip documentation.
    There are 3 examples. The first 2 wrap ordinary 'C' code. These examples work.
    The third example doesn't explain what files go into what folders and appears to not document one of the files. I could not make this work. This example was to demonstrate importing a module from another module. It did not wrap a QWidget. I can't find anything using sip-build that wraps a QWidget.

  • @jeffreybritton
    If you do not get an answer here, sip questions may best be addressed to PyQt authors,

Log in to reply