src/tools/uic/cpp/cppwriteinitialization.cpp
changeset 3 41300fa6a67c
parent 0 1918ee327afb
child 4 3b1da2848fc7
equal deleted inserted replaced
2:56cd8111b7f7 3:41300fa6a67c
   668     if (node->elementLayout().isEmpty())
   668     if (node->elementLayout().isEmpty())
   669         m_layoutChain.push(0);
   669         m_layoutChain.push(0);
   670 
   670 
   671     m_layoutWidget = false;
   671     m_layoutWidget = false;
   672     if (className == QLatin1String("QWidget") && !node->hasAttributeNative()) {
   672     if (className == QLatin1String("QWidget") && !node->hasAttributeNative()) {
   673         if (m_widgetChain.top()
   673         if (const DomWidget* parentWidget = m_widgetChain.top()) {
   674             && m_widgetChain.top()->attributeClass() != QLatin1String("QMainWindow")
   674             const QString parentClass = parentWidget->attributeClass();
   675             && !m_uic->isContainer(m_widgetChain.top()->attributeClass()))
   675             if (parentClass != QLatin1String("QMainWindow")
       
   676                 && !m_uic->isCustomWidgetContainer(parentClass)
       
   677                 && !m_uic->isContainer(parentClass))
   676             m_layoutWidget = true;
   678             m_layoutWidget = true;
       
   679         }
   677     }
   680     }
   678     m_widgetChain.push(node);
   681     m_widgetChain.push(node);
   679     m_layoutChain.push(0);
   682     m_layoutChain.push(0);
   680     TreeWalker::acceptWidget(node);
   683     TreeWalker::acceptWidget(node);
   681     m_layoutChain.pop();
   684     m_layoutChain.pop();
   716             }
   719             }
   717 
   720 
   718             m_output << m_indent << parentWidget << "->addDockWidget(" << area << varName << ");\n";
   721             m_output << m_indent << parentWidget << "->addDockWidget(" << area << varName << ");\n";
   719         } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QStatusBar"))) {
   722         } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QStatusBar"))) {
   720             m_output << m_indent << parentWidget << "->setStatusBar(" << varName << ");\n";
   723             m_output << m_indent << parentWidget << "->setStatusBar(" << varName << ");\n";
   721         } else if (className == QLatin1String("QWidget")) {
   724         } else {
   722             m_output << m_indent << parentWidget << "->setCentralWidget(" << varName << ");\n";
   725             m_output << m_indent << parentWidget << "->setCentralWidget(" << varName << ");\n";
   723         }
   726         }
   724     }
   727     }
   725 
   728 
   726     // Check for addPageMethod of a custom plugin first
   729     // Check for addPageMethod of a custom plugin first
  2704         return;
  2707         return;
  2705 
  2708 
  2706     m_output << m_indent << "QObject::connect("
  2709     m_output << m_indent << "QObject::connect("
  2707         << sender
  2710         << sender
  2708         << ", "
  2711         << ", "
  2709         << "SIGNAL(" << connection->elementSignal() << ')'
  2712         << "SIGNAL("<<connection->elementSignal()<<')'
  2710         << ", "
  2713         << ", "
  2711         << receiver
  2714         << receiver
  2712         << ", "
  2715         << ", "
  2713         << "SLOT(" << connection->elementSlot() << ')'
  2716         << "SLOT("<<connection->elementSlot()<<')'
  2714         << ");\n";
  2717         << ");\n";
  2715 }
  2718 }
  2716 
  2719 
  2717 DomImage *WriteInitialization::findImage(const QString &name) const
  2720 DomImage *WriteInitialization::findImage(const QString &name) const
  2718 {
  2721 {