[Interest] Getting source url of QML composite component from C++
Sebastian Hartte
sebastian at hartte.de
Fri Apr 17 17:51:10 CEST 2020
Hi all,
I am working on a tool to generate C# bindings for QML components defined
in .qml files,
and have hit a snag: How do I determine the source URL of a QML component
that is
used as the type of a QML property.
Example.qml:
import "./dirwithqmldir"
Item {
// Comes from "dirwithqmldir/OtherQmlItem.qml"
property OtherQmlItem myprop
}
When I inspect the QMetaObject that gets generated for an instance of this
Item,
the "myprop" property will have a UserType that is named
"OtherQmlItem_QMLTYPE2".
The registered Qt meta type has no meta object itself.
I am desperately trying to get at the source url of the underlying QML
component,
but haven't found a working way.
I see that the QQMLEnginePrivate has the following field, which would have
what I need,
but it's even private in there:
QHash<int, QV4::ExecutableCompilationUnit *> m_compositeTypes;
Are there any other ways of getting the source url given a meta type id
(and associated QQMLEngine, if needed)?
Best Regards
Sebastian
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20200417/b7171cd2/attachment.html>
More information about the Interest
mailing list