Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Qt Creator and other tools
  4. Need help with sip to create a PyQt5 wrapper for a C++ object that inherits from QWidget.
Forum Updated to NodeBB v4.3 + New Features

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

Scheduled Pinned Locked Moved Unsolved Qt Creator and other tools
2 Posts 2 Posters 973 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jeffreybritton
    wrote on 15 Jun 2021, 23:11 last edited by
    #1

    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:
    https://github.com/eyllanesc/Qt5toPyQt5
    python configure.py 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.

    J 1 Reply Last reply 16 Jun 2021, 06:33
    0
    • J jeffreybritton
      15 Jun 2021, 23:11

      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:
      https://github.com/eyllanesc/Qt5toPyQt5
      python configure.py 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.

      J Offline
      J Offline
      JonB
      wrote on 16 Jun 2021, 06:33 last edited by
      #2

      @jeffreybritton
      If you do not get an answer here, sip questions may best be addressed to PyQt authors, https://riverbankcomputing.com/mailman/listinfo/pyqt.

      1 Reply Last reply
      0

      1/2

      15 Jun 2021, 23:11

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved