void tst_QBoxLayout::insertLayout() { QWidget *window = new QWidget; QVBoxLayout *vbox = new QVBoxLayout(window); QVBoxLayout *dummyParentLayout = new QVBoxLayout; QHBoxLayout *subLayout = new QHBoxLayout; dummyParentLayout->addLayout(subLayout); QCOMPARE(subLayout->parent(), dummyParentLayout); QCOMPARE(dummyParentLayout->count(), 1); // add subLayout to another layout QTest::ignoreMessage(QtWarningMsg, "QLayout::addChildLayout: layout \"\" already has a parent"); vbox->addLayout(subLayout); QCOMPARE((subLayout->parent() == vbox), (vbox->count() == 1)); delete dummyParentLayout; delete window; }