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

NIkolai Marchenko enmarantispam at gmail.com
Fri May 3 18:24:18 CEST 2024


> That means it's relying on some automatic registration somewhere, somehow.
> That's poor programming practice.

The alternative was way,way worse. There's simply no way to avoid this
reliance without refactoring the entirety of the codebase and it works
perfectly well outside test scenarios.
I just need to understand how to properly set up test environment for it.

On Fri, May 3, 2024 at 7:21 PM Thiago Macieira <thiago.macieira at intel.com>
wrote:

> On Friday 3 May 2024 08:51:39 GMT-7 NIkolai Marchenko wrote:
> > I am assuming the registration of qquicklayout is deferred somewhere
> > but what are the exact timings and conditions?
>
> There's no explicit registration of this type, anywhere in the sources. I
> don't even see anything that would be an automatic registration; maybe it
> gets
> put into a QVariant somewhere that my git grep didn't see.
>
> But one of the unit tests assumes it exists, like your code does:
> https://code.qt.io/cgit/qt/qtdeclarative.git/tree/tests/auto/qml/
> qmlcppcodegen/tst_qmlcppcodegen.cpp#n1646
> <https://code.qt.io/cgit/qt/qtdeclarative.git/tree/tests/auto/qml/qmlcppcodegen/tst_qmlcppcodegen.cpp#n1646>
>
> That means it's relying on some automatic registration somewhere, somehow.
>
> That's poor programming practice.
>
> --
> Thiago Macieira - thiago.macieira (AT) intel.com
>   Principal Engineer - Intel DCAI Cloud Engineering
> _______________________________________________
> Interest mailing list
> Interest at qt-project.org
> https://lists.qt-project.org/listinfo/interest
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20240503/9c690d09/attachment.htm>


More information about the Interest mailing list