[PyQt] How to call the non-template version of qmlRegisterType

Phil Thompson phil at riverbankcomputing.com
Sun Nov 16 17:30:59 GMT 2014


On 12/11/2014 4:12 pm, B. B. wrote:
> Hello,
> 
> Looking in the docs and the c++ sources, there should be a non template
> version of the
> qmlRegisterType ...
> 
>  inline int qmlRegisterType(const QUrl &url, const char *uri, int
> versionMajor, int versionMinor, const char *qmlName)
> {
>     if (url.isRelative()) {
>         // User input check must go here, because
> QQmlPrivate::qmlregister is also used internally for composite types
>         qWarning("qmlRegisterType requires absolute URLs.");
>         return 0;
> 
> 
> along with 3 template versions...
> 
> template<typename T>
> int qmlRegisterType()
> {
>     QML_GETTYPENAMES
>      QQmlPrivate::RegisterType type = {
>         0,
> 
> 
>  template<typename T>
> int qmlRegisterType(const char *uri, int versionMajor, int
> versionMinor, const char *qmlName)
> {
>     QML_GETTYPENAMES
>      QQmlPrivate::RegisterType type = {
> 
> 
> template<typename T, int metaObjectRevision>
> int qmlRegisterType(const char *uri, int versionMajor, int
> versionMinor, const char *qmlName)
> {
>     QML_GETTYPENAMES
>      QQmlPrivate::RegisterType type = {
>         1,
> 
> 
> I have not so much experience with pyqt, so I guess there is a calling
> convention I have misssed???
> 
> I would never claim it is not exposed to python yet.. :-)...
> 
> 
> I am using the sources PyQt-gpl-5.4-snapshot-837edec02d98.
> 
> The error written to the console when I call try calling it, is :
> 
> TypeError: arguments did not match any overloaded call:
>   qmlRegisterType(type, type attachedProperties=0): argument 1 has
> unexpected type 'QUrl'
>   qmlRegisterType(type, str, int, int, str, type attachedProperties=0):
> argument 1 has unexpected type 'QUrl'
>   qmlRegisterType(type, int, str, int, int, str, type
> attachedProperties=0): argument 1 has unexpected type 'QUrl'

It was missing - should be tonight's snapshot.

Thanks,
Phil


More information about the PyQt mailing list