[Development] QQmlListProperty<T>: static_assert that T inherits QObject

Milian Wolff milian.wolff at kdab.com
Fri Jan 27 16:54:54 CET 2017


On Friday, January 27, 2017 4:49:15 PM CET Simon Hausmann wrote:
> Hi,
> 
> 
> Regarding the question about why the engine itself uses
> QQmlListProperty<void> internally when populating list properties during 
instantiation, I think you've already found the answer yourself: Because of 
interface types :)

I.e. we need to keep it that way - ok.

> I think it would be great if incorrectly used types could be reported to the
> developer as early as possible, but at the same time the ability to things
> like forward-declaring "Foo" used by "Q_PROPERTY(QQmlListProperty<Foo> ...)"
> is likely a feature used by many people when designing class interfaces. So
> I'm not sure it's a good idea to suddenly break their build when upgrading
> to a new version of Qt.

Has anyone an idea how to fix that in a different way then?

It's a pity imo, if we decide that forward declaring is more important than 
enforcing the correct type hierarchy.

Bye

-- 
Milian Wolff | milian.wolff at kdab.com | Software Engineer
KDAB (Deutschland) GmbH&Co KG, a KDAB Group company
Tel: +49-30-521325470
KDAB - The Qt Experts
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5903 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20170127/ef3153da/attachment.bin>


More information about the Development mailing list