src/tools/uic/cpp/cppwriteinitialization.cpp
changeset 7 f7bc934e204c
parent 3 41300fa6a67c
--- a/src/tools/uic/cpp/cppwriteinitialization.cpp	Tue Feb 02 00:43:10 2010 +0200
+++ b/src/tools/uic/cpp/cppwriteinitialization.cpp	Wed Mar 31 11:06:36 2010 +0300
@@ -1,6 +1,6 @@
 /****************************************************************************
 **
-** Copyright (C) 2009 Nokia Corporation and/or its subsidiary(-ies).
+** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
 ** All rights reserved.
 ** Contact: Nokia Corporation (qt-info@nokia.com)
 **
@@ -721,8 +721,9 @@
             m_output << m_indent << parentWidget << "->addDockWidget(" << area << varName << ");\n";
         } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QStatusBar"))) {
             m_output << m_indent << parentWidget << "->setStatusBar(" << varName << ");\n";
-        } else {
-            m_output << m_indent << parentWidget << "->setCentralWidget(" << varName << ");\n";
+        } else if (!m_uic->customWidgetsInfo()->extends(className, QLatin1String("Q3DockWindow"))
+                   && !m_uic->customWidgetsInfo()->extends(className, QLatin1String("Q3ToolBar"))) {
+                m_output << m_indent << parentWidget << "->setCentralWidget(" << varName << ");\n";
         }
     }
 
@@ -1221,9 +1222,10 @@
             const DomRect *r = p->elementRect();
             m_output << m_indent << varName << "->resize(" << r->elementWidth() << ", " << r->elementHeight() << ");\n";
             continue;
-        } else if (propertyName == QLatin1String("buttonGroupId") && buttonGroupWidget) { // Q3ButtonGroup support
-            m_output << m_indent << m_driver->findOrInsertWidget(buttonGroupWidget) << "->insert("
-                   << varName << ", " << p->elementNumber() << ");\n";
+        } else if (propertyName == QLatin1String("buttonGroupId")) { // Q3ButtonGroup support
+            if (buttonGroupWidget)
+                m_output << m_indent << m_driver->findOrInsertWidget(buttonGroupWidget) << "->insert("
+                         << varName << ", " << p->elementNumber() << ");\n";
             continue;
         } else if (propertyName == QLatin1String("currentRow") // QListWidget::currentRow
                     && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QListWidget"))) {
@@ -2786,8 +2788,8 @@
         return;
 
     QMap<QString, bool> map; // bool is dummy. The idea is to sort that (always generate in the same order) by putting a set into a map
-    foreach (QString str, directives)
-        map[str] = true;
+    foreach (const QString &str, directives)
+        map.insert(str, true);
 
     if (map.size() == 1) {
         outputStream << "#ifndef " << map.constBegin().key() << endl;
@@ -2796,7 +2798,7 @@
 
     outputStream << "#if";
     bool doOr = false;
-    foreach (QString str, map.keys()) {
+    foreach (const QString &str, map.keys()) {
         if (doOr)
             outputStream << " ||";
         outputStream << " !defined(" << str << ')';