[Interest] Subclassing QQmlComponent for use in QML
Gian Maxera
gmaxera at gmail.com
Fri Jun 19 12:49:32 CEST 2015
Not sure want you need.
If you just need to create your objects from QML, it’s not mandatory to extend from QQmlComponent but from QObject.
So, if you create a C++ class derived from QObject called:
class MyNewQML : public QObject
and you register is with qmlRegisterType
you can write into QML:
MyNewQML {
….
}
Ciao,
Gianluca.
> On 19 Jun 2015, at 11:44, Evgeny Grablyk <evgeny.grablyk at gmail.com> wrote:
>
> Hello,
>
> I need a subclass of QQmlComponent that would be usable inside QML
> documents just like a normal Component, in order to have more control
> over the return value of create().
>
> However, simply creating a subclass in C++ and registering it via
> qmlRegisterType() fails: attempting to use the custom component
> results in "Cannot assign to non-existent default property" error.
>
> I've failed to find any documentation or examples on the topic. Should
> this be possible from user code at all? If so, what is the correct way
> to subclass a QQmlComponent?
>
> Thanks.
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> http://lists.qt-project.org/mailman/listinfo/interest
More information about the Interest
mailing list