diff options
Diffstat (limited to 'src/tools')
-rw-r--r-- | src/tools/uic/cpp/cppwriteinitialization.cpp | 9 | ||||
-rw-r--r-- | src/tools/uic/customwidgetsinfo.cpp | 8 | ||||
-rw-r--r-- | src/tools/uic/customwidgetsinfo.h | 2 | ||||
-rw-r--r-- | src/tools/uic/uic.cpp | 5 | ||||
-rw-r--r-- | src/tools/uic/uic.h | 1 |
5 files changed, 22 insertions, 3 deletions
diff --git a/src/tools/uic/cpp/cppwriteinitialization.cpp b/src/tools/uic/cpp/cppwriteinitialization.cpp index 1690c2ef96..74a4b9d00f 100644 --- a/src/tools/uic/cpp/cppwriteinitialization.cpp +++ b/src/tools/uic/cpp/cppwriteinitialization.cpp @@ -670,10 +670,13 @@ void WriteInitialization::acceptWidget(DomWidget *node) m_layoutWidget = false; if (className == QLatin1String("QWidget") && !node->hasAttributeNative()) { - if (m_widgetChain.top() - && m_widgetChain.top()->attributeClass() != QLatin1String("QMainWindow") - && !m_uic->isContainer(m_widgetChain.top()->attributeClass())) + if (const DomWidget* parentWidget = m_widgetChain.top()) { + const QString parentClass = parentWidget->attributeClass(); + if (parentClass != QLatin1String("QMainWindow") + && !m_uic->isCustomWidgetContainer(parentClass) + && !m_uic->isContainer(parentClass)) m_layoutWidget = true; + } } m_widgetChain.push(node); m_layoutChain.push(0); diff --git a/src/tools/uic/customwidgetsinfo.cpp b/src/tools/uic/customwidgetsinfo.cpp index 70adba298e..ca3fd19d36 100644 --- a/src/tools/uic/customwidgetsinfo.cpp +++ b/src/tools/uic/customwidgetsinfo.cpp @@ -88,6 +88,14 @@ bool CustomWidgetsInfo::extends(const QString &classNameIn, const QLatin1String return false; } +bool CustomWidgetsInfo::isCustomWidgetContainer(const QString &className) const +{ + if (const DomCustomWidget *dcw = m_customWidgets.value(className, 0)) + if (dcw->hasElementContainer()) + return dcw->elementContainer() != 0; + return false; +} + QString CustomWidgetsInfo::realClassName(const QString &className) const { if (className == QLatin1String("Line")) diff --git a/src/tools/uic/customwidgetsinfo.h b/src/tools/uic/customwidgetsinfo.h index 1471118872..d5be5a2948 100644 --- a/src/tools/uic/customwidgetsinfo.h +++ b/src/tools/uic/customwidgetsinfo.h @@ -78,6 +78,8 @@ public: bool extends(const QString &className, const QLatin1String &baseClassName) const; + bool isCustomWidgetContainer(const QString &className) const; + private: typedef QMap<QString, DomCustomWidget*> NameCustomWidgetMap; NameCustomWidgetMap m_customWidgets; diff --git a/src/tools/uic/uic.cpp b/src/tools/uic/uic.cpp index 32e5e3d41c..71b6ac1ab2 100644 --- a/src/tools/uic/uic.cpp +++ b/src/tools/uic/uic.cpp @@ -363,6 +363,11 @@ bool Uic::isContainer(const QString &className) const || customWidgetsInfo()->extends(className, QLatin1String("QDockWidget")); } +bool Uic::isCustomWidgetContainer(const QString &className) const +{ + return customWidgetsInfo()->isCustomWidgetContainer(className); +} + bool Uic::isStatusBar(const QString &className) const { return customWidgetsInfo()->extends(className, QLatin1String("QStatusBar")); diff --git a/src/tools/uic/uic.h b/src/tools/uic/uic.h index 3e072a4019..5175ea9ad3 100644 --- a/src/tools/uic/uic.h +++ b/src/tools/uic/uic.h @@ -115,6 +115,7 @@ public: bool isStatusBar(const QString &className) const; bool isButton(const QString &className) const; bool isContainer(const QString &className) const; + bool isCustomWidgetContainer(const QString &className) const; bool isMenuBar(const QString &className) const; bool isMenu(const QString &className) const; |