Hey all, the QQmlListProperty states:
"Note: QQmlListProperty can only be used for lists of QObject-derived object pointers." Since I am bad at reading documentation, I previously tried (I think multiple times) to do something like: QQmlListProperty<MyGadget> or even QQmlListProperty<NeitherQObjectNorQGadget> This happily compiles and only at runtime does it not work. So I thought I'd add a static assert to QQmlListProperty to check this at compile time: https://codereview.qt-project.org/#/c/183631/ But this uncovered this gem inside qtdeclarative itself: qqmlobjectcreator_p.h: 158: QQmlListProperty<void> _currentList; Uhm, a void* list, really? Should this be a QQmlListProperty<QObject>? Digging further, I find a few places where QQmlListProperty<T> is instantiated for non-QObjects, mostly within qmlRegisterUncreateableType, which is easy to prevent by leveraging std::enable_if. Digging even further, I hit the first road-block though with my approach: Adding the static assert directly to QQmlListProperty means that T must be fully defined when the list property gets used. Does this make this change source-incompatible? Is there a workaround for this? I fixed the issues inside Qt Declarative itself, but I wonder whether this is acceptable for existing users of QQmlListProperty outside of QtDeclarative. The second road-block comes when compiling the tests - apparently QQmlListProperty also works with interfaces! So I added another type trait for that. Is that acceptable? Thanks -- Milian Wolff | [email protected] | Software Engineer KDAB (Deutschland) GmbH&Co KG, a KDAB Group company Tel: +49-30-521325470 KDAB - The Qt Experts
smime.p7s
Description: S/MIME cryptographic signature
_______________________________________________ Development mailing list [email protected] http://lists.qt-project.org/mailman/listinfo/development
