Quantcast
Channel: QtWebEngine
Viewing all articles
Browse latest Browse all 13965

[SOLVED] qmlRegisterType error with parameterized constructor

$
0
0
Hi I have a class. its constructor takes two parameters. 1st parameter type is a custom class I wrote (SomeLib), 2nd parameter is the QObject * parent. In the constructor, the 1st argument is used to initialize a class reference variable (SomeLib &libby). in main, when I call qmlRegisterTypes<MyClass>(“MyClass”, 1,0, “MyClass”); I get the following error: “no matching function for call to MyClass::MyClass()” in qdeclarative.h But when I call qmlRegisterTypes<MyClass>(“MyClass”, 1,0, “MyClass”); without specifying the 1st parameter in the prototype, meaning, I only have the QObject parameter, qmlRegisterType works. I think its trying to call the constructor using qdecl, but cant find a value for the “SomeLib” parameter, but the document doesn’t specify that no parameterized constructors are to be used for registering a type to QML. I don’t yet understand what I’m doing wrong and I’m losing more hair than I planned. if anyone can point me in the right direction, or give me a work around or something, i’d appreciate it. I’m using qt 4.8 Regards Ruben

Viewing all articles
Browse latest Browse all 13965

Trending Articles