From c3737573ced4dc2217f31aac627fa8070e7512c8 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 21 Apr 2015 08:25:28 +0200 Subject: uic: Delay the setting of QPushButton::default. For the property to take effect, the button must have its parent set. This might not be the case when a container like for example QTabWidget is involved. Move the setting of the property to the bottom of setupUi. Task-number: QTBUG-44406 Change-Id: Ic2013865a020986475fa28f2e3805c63d4de8ed0 Reviewed-by: Marc Mutz --- src/tools/uic/cpp/cppwriteinitialization.cpp | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/tools/uic/cpp/cppwriteinitialization.cpp') 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)); -- cgit v1.2.3