diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 78f243a6d3..b02e2dc0ed 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -1176,6 +1176,7 @@ void WriteInitialization::writeProperties(const QString &varName, continue; QString propertyName = p->attributeName(); QString propertyValue; + bool delayProperty = false; // special case for the property `geometry': Do not use position if (isTopLevel && propertyName == QLatin1String("geometry") && p->elementRect()) { @@ -1204,6 +1205,10 @@ void WriteInitialization::writeProperties(const QString &varName, && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QAxWidget"))) { // already done ;) continue; + } else if (propertyName == QLatin1String("default") + && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QPushButton"))) { + // QTBUG-44406: Setting of QPushButton::default needs to be delayed until the parent is set + delayProperty = true; } else if (propertyName == QLatin1String("database") && p->elementStringList()) { // Sql support @@ -1479,7 +1484,7 @@ void WriteInitialization::writeProperties(const QString &varName, else if (propertyName == QLatin1String("accessibleName") || propertyName == QLatin1String("accessibleDescription")) defineC = accessibilityDefineC; - QTextStream &o = autoTrOutput(p); + QTextStream &o = delayProperty ? m_delayedOut : autoTrOutput(p); if (defineC) openIfndef(o, QLatin1String(defineC)); diff --git a/tests/auto/tools/uic/baseline/addtorrentform.ui.h b/tests/auto/tools/uic/baseline/addtorrentform.ui.h index 29bae9735c..5aca0c4e47 100644 --- a/tests/auto/tools/uic/baseline/addtorrentform.ui.h +++ b/tests/auto/tools/uic/baseline/addtorrentform.ui.h @@ -97,7 +97,6 @@ public: browseTorrents = new QPushButton(groupBox); browseTorrents->setObjectName(QStringLiteral("browseTorrents")); - browseTorrents->setDefault(true); gridLayout->addWidget(browseTorrents, 0, 3, 1, 1); @@ -205,6 +204,9 @@ public: QObject::connect(okButton, SIGNAL(clicked()), AddTorrentFile, SLOT(accept())); QObject::connect(cancelButton, SIGNAL(clicked()), AddTorrentFile, SLOT(reject())); + browseTorrents->setDefault(true); + + QMetaObject::connectSlotsByName(AddTorrentFile); } // setupUi diff --git a/tests/auto/tools/uic/baseline/config.ui.h b/tests/auto/tools/uic/baseline/config.ui.h index 0775c02346..2d9003b4b9 100644 --- a/tests/auto/tools/uic/baseline/config.ui.h +++ b/tests/auto/tools/uic/baseline/config.ui.h @@ -688,7 +688,6 @@ public: buttonOk = new QPushButton(Config); buttonOk->setObjectName(QStringLiteral("buttonOk")); buttonOk->setAutoDefault(true); - buttonOk->setDefault(true); hboxLayout3->addWidget(buttonOk); @@ -706,6 +705,9 @@ public: QObject::connect(size_width, SIGNAL(valueChanged(int)), size_custom, SLOT(click())); QObject::connect(size_height, SIGNAL(valueChanged(int)), size_custom, SLOT(click())); + buttonOk->setDefault(true); + + QMetaObject::connectSlotsByName(Config); } // setupUi diff --git a/tests/auto/tools/uic/baseline/finddialog.ui.h b/tests/auto/tools/uic/baseline/finddialog.ui.h index 50595edc8a..259d36569f 100644 --- a/tests/auto/tools/uic/baseline/finddialog.ui.h +++ b/tests/auto/tools/uic/baseline/finddialog.ui.h @@ -164,7 +164,6 @@ public: vboxLayout1->setObjectName(QStringLiteral("vboxLayout1")); findNxt = new QPushButton(FindDialog); findNxt->setObjectName(QStringLiteral("findNxt")); - findNxt->setDefault(true); findNxt->setFlat(false); vboxLayout1->addWidget(findNxt); @@ -194,6 +193,9 @@ public: retranslateUi(FindDialog); QObject::connect(cancel, SIGNAL(clicked()), FindDialog, SLOT(reject())); + findNxt->setDefault(true); + + QMetaObject::connectSlotsByName(FindDialog); } // setupUi diff --git a/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h b/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h index 484c0877bc..31edb426fe 100644 --- a/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h +++ b/tests/auto/tools/uic/baseline/qsqlconnectiondialog.ui.h @@ -171,7 +171,6 @@ public: okButton = new QPushButton(QSqlConnectionDialogUi); okButton->setObjectName(QStringLiteral("okButton")); - okButton->setDefault(true); hboxLayout1->addWidget(okButton); @@ -202,6 +201,9 @@ public: retranslateUi(QSqlConnectionDialogUi); + okButton->setDefault(true); + + QMetaObject::connectSlotsByName(QSqlConnectionDialogUi); } // setupUi diff --git a/tests/auto/tools/uic/baseline/sslclient.ui.h b/tests/auto/tools/uic/baseline/sslclient.ui.h index a74a465955..f2071d8780 100644 --- a/tests/auto/tools/uic/baseline/sslclient.ui.h +++ b/tests/auto/tools/uic/baseline/sslclient.ui.h @@ -86,7 +86,6 @@ public: connectButton = new QPushButton(Form); connectButton->setObjectName(QStringLiteral("connectButton")); connectButton->setEnabled(true); - connectButton->setDefault(true); vboxLayout->addWidget(connectButton); @@ -136,7 +135,6 @@ public: sendButton->setObjectName(QStringLiteral("sendButton")); sendButton->setEnabled(false); sendButton->setFocusPolicy(Qt::TabFocus); - sendButton->setDefault(true); hboxLayout1->addWidget(sendButton); @@ -151,6 +149,10 @@ public: QObject::connect(hostNameEdit, SIGNAL(returnPressed()), connectButton, SLOT(animateClick())); QObject::connect(sessionInput, SIGNAL(returnPressed()), sendButton, SLOT(animateClick())); + connectButton->setDefault(true); + sendButton->setDefault(true); + + QMetaObject::connectSlotsByName(Form); } // setupUi diff --git a/tests/auto/tools/uic/baseline/topicchooser.ui.h b/tests/auto/tools/uic/baseline/topicchooser.ui.h index 06d34e9c63..3935a7a87b 100644 --- a/tests/auto/tools/uic/baseline/topicchooser.ui.h +++ b/tests/auto/tools/uic/baseline/topicchooser.ui.h @@ -77,7 +77,6 @@ public: buttonDisplay = new QPushButton(Layout16); buttonDisplay->setObjectName(QStringLiteral("buttonDisplay")); buttonDisplay->setAutoDefault(true); - buttonDisplay->setDefault(true); hboxLayout->addWidget(buttonDisplay); @@ -96,6 +95,9 @@ public: retranslateUi(TopicChooser); + buttonDisplay->setDefault(true); + + QMetaObject::connectSlotsByName(TopicChooser); } // setupUi diff --git a/tests/auto/tools/uic/baseline/translatedialog.ui.h b/tests/auto/tools/uic/baseline/translatedialog.ui.h index 72a2b48f2e..c494ca77c3 100644 --- a/tests/auto/tools/uic/baseline/translatedialog.ui.h +++ b/tests/auto/tools/uic/baseline/translatedialog.ui.h @@ -164,7 +164,6 @@ public: vboxLayout2->setContentsMargins(0, 0, 0, 0); findNxt = new QPushButton(TranslateDialog); findNxt->setObjectName(QStringLiteral("findNxt")); - findNxt->setDefault(true); findNxt->setFlat(false); vboxLayout2->addWidget(findNxt); @@ -206,6 +205,9 @@ public: retranslateUi(TranslateDialog); QObject::connect(cancel, SIGNAL(clicked()), TranslateDialog, SLOT(reject())); + findNxt->setDefault(true); + + QMetaObject::connectSlotsByName(TranslateDialog); } // setupUi