[Interest] what are the requirements for QMetaType::metaObjectForType(QMetaType::type("QQuickLayout*")) to work?

NIkolai Marchenko enmarantispam at gmail.com
Fri May 3 17:51:39 CEST 2024


A bit of context:
Qt 5.15, since by default qquicklayout is an internal qt type but we need
to have a custom intermediary attached Layout type, I am using code like
this:

    auto metaObject =
QMetaType::metaObjectForType(QMetaType::type("QQuickLayout*"));
    const auto func = qmlAttachedPropertiesFunction(parent, metaObject);
    m_attachedProperties.object = qmlAttachedPropertiesObject(parent, func,
true);
    // below are registrations of custom bindings

this works fine in our actual application but for whatever reason when qml
tests are being run the line
    QMetaType::metaObjectForType(QMetaType::type("QQuickLayout*"));
returns nullptr in the constructor of a type that has a custom attached
layout. it also returns nullptr in qmlEngineAvailable of the test's setup
class. I am assuming the registration of qquicklayout is deferred somewhere
but what are the exact timings and conditions?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240503/5bc92bdf/attachment.htm>


More information about the Interest mailing list