[Development] QML, Widgets, and setParent

Konrad Rosenbaum konrad at silmor.de
Thu Oct 31 20:17:43 CET 2013


Hi,

I'm trying to port KDAB's DeclarativeWidgets[1] to Qt5. I've got it running 
for trivial QML files, however as soon as there are child widgets the 
running program aborts.

The abort is caused by QObject::setParent, which contains this little gem: 
Q_ASSERT(!d->isWidget);

Apart from not understanding why there is a significant difference between 
QObjects and QWidgets in regards to parenting...

There used to be code that handled this in qqmlvme.cpp[2], but it has been 
disabled by an #if 0 . Apparently to remove dependencies on QtWidgets from 
QtQml.

I kind of ran out of ideas on how to solve this. Should I consider 
setParent, qqmlvme or the direct use of QWidgets as a bug?



	Konrad


[1] It enables you to create widget based GUIs using QML. 
git://github.com/KDAB/DeclarativeWidgets

[2] In 5.2 beta this is line 627 in qqmlvme.cpp. It's Halloween. Go ahead, 
look at scary code! ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 588 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131031/c94c087b/attachment.sig>


More information about the Development mailing list