Hi,
I just find a assert failure when I use QLayout. I want know is this a bug of QLayout.
The QLayout has a constructor like this, which need a parent of QWdiget
Code:
{ if (!parent) return; parent->setLayout(this); }
But in the code of QLayout::parentWidget() (line 6), it trys to cast the parent to QLayout
Code:
{ if (!d->topLevel) { if (parent()) { Q_ASSERT(parentLayout); return parentLayout->parentWidget(); } else { return 0; } } else { Q_ASSERT(parent() && parent()->isWidgetType()); return static_cast<QWidget *>(parent()); } }
certainly, cast from QWidget* to QLayout* will failled, and the successed assertion will failed. Is this a bug or anything I don't know?
Thanks for your help!