Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

PySide6.QtQml.qmlRegisterType signature error in QtQml.pyi



  • qmlRegisterType signature:

    PySide6.QtQml.qmlRegisterType(type, bytes, int, int, bytes)
    

    But when I call method :

        qmlRegisterType(TestSet, b"Test", 1, 0, b"TestSet")
    
    

    I get error:

        qmlRegisterType(TestSet, b"Test", 1, 0, b"TestSet")
    ValueError: 'PySide6.QtQml.qmlRegisterType' called with wrong argument values:
      PySide6.QtQml.qmlRegisterType(<class 'testtool.testset.TestSet'>, b'Test', 1, 0, b'TestSet')
    Found signature:
      PySide6.QtQml.qmlRegisterType(type, bytes, int, int, bytes)
    


  • @xhcoding There seems to be a bug in the PySide6 docs. String should be used instead of bytes:

    from PySide6.QtCore import QObject
    from PySide6.QtQml import qmlRegisterType
    
    
    class TestSet(QObject):
        pass
    
    
    qmlRegisterType(TestSet, "Test", 1, 0, "TestSet")
    


  • Hi @xhcoding ,

    I checked the PySide bug report system to see if there's something related with it but I didn't find anything. Maybe you can open a new ticket providing a description and a minimal script reproducing the issue.

    Regards



  • @xhcoding There seems to be a bug in the PySide6 docs. String should be used instead of bytes:

    from PySide6.QtCore import QObject
    from PySide6.QtQml import qmlRegisterType
    
    
    class TestSet(QObject):
        pass
    
    
    qmlRegisterType(TestSet, "Test", 1, 0, "TestSet")
    

Log in to reply