diff options
-rw-r--r-- | src/quicktemplates2/qquickcombobox.cpp | 2 | ||||
-rw-r--r-- | tests/auto/customization/tst_customization.cpp | 14 |
2 files changed, 15 insertions, 1 deletions
diff --git a/src/quicktemplates2/qquickcombobox.cpp b/src/quicktemplates2/qquickcombobox.cpp index fb10730e..55ff0e55 100644 --- a/src/quicktemplates2/qquickcombobox.cpp +++ b/src/quicktemplates2/qquickcombobox.cpp @@ -1603,9 +1603,9 @@ void QQuickComboBox::componentComplete() { Q_D(QQuickComboBox); d->executeIndicator(true); + QQuickControl::componentComplete(); if (d->popup) d->executePopup(true); - QQuickControl::componentComplete(); if (d->delegateModel && d->ownModel) static_cast<QQmlDelegateModel *>(d->delegateModel)->componentComplete(); diff --git a/tests/auto/customization/tst_customization.cpp b/tests/auto/customization/tst_customization.cpp index 3010565c..977bcb61 100644 --- a/tests/auto/customization/tst_customization.cpp +++ b/tests/auto/customization/tst_customization.cpp @@ -481,6 +481,20 @@ void tst_customization::comboPopup() QTest::mouseClick(&window, Qt::LeftButton, Qt::NoModifier, QPoint(1, 1)); QVERIFY(qt_createdQObjects()->contains("combobox-popup-simple")); } + + reset(); + + { + // test that ComboBox::popup is completed upon component completion (if appropriate) + QQmlComponent component(engine); + component.setData("import QtQuick 2.9; import QtQuick.Controls 2.2; ComboBox { id: control; contentItem: Item { visible: !control.popup.visible } popup: Popup { property bool wasCompleted: false; Component.onCompleted: wasCompleted = true } }", QUrl()); + QScopedPointer<QQuickItem> comboBox(qobject_cast<QQuickItem *>(component.create())); + QVERIFY(comboBox); + + QObject *popup = comboBox->property("popup").value<QObject *>(); + QVERIFY(popup); + QCOMPARE(popup->property("wasCompleted"), QVariant(true)); + } } QTEST_MAIN(tst_customization) |