[Development] QML, Widgets, and setParent

Kevin Krammer kevin.krammer at kdab.com
Sat Nov 2 10:23:13 CET 2013


On Thursday, 2013-10-31, 20:17:43, Konrad Rosenbaum wrote:
> Hi,
> 
> I'm trying to port KDAB's DeclarativeWidgets[1] to Qt5. 

Cool!

> 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);

Hmm. The same code is in Qt4. I think it "works for me/us" because we are 
building against our distribution's Qt packages which are release builds and 
thus doesn't have the Q_ASSERT.

> 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?

I agree with Alan on setParent() being in error, the problem is some other 
areas rely on that. E.g. QWidget::parentWidget() does a static_cast of 
parent() to QWidget*

Cheers,
Kevin

-- 
Kevin Krammer | kevin.krammer at kdab.com | Software Engineer
Klarälvdalens Datakonsult AB, a KDAB Group company
Tel. Sweden (HQ) +46-563-540090, USA +1-866-777-KDAB(5322)
KDAB - Qt Experts - Platform-independent software solutions
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5918 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/development/attachments/20131102/303e397a/attachment.bin>


More information about the Development mailing list