diff --git a/ruby/rbwriteinitialization.cpp b/ruby/rbwriteinitialization.cpp
index 2f0f226..7f6b089 100644
--- a/ruby/rbwriteinitialization.cpp
+++ b/ruby/rbwriteinitialization.cpp
@@ -52,6 +52,7 @@
 
 #include <QtCore/QTextStream>
 #include <QtCore/QDebug>
+#include <QFileInfo>
 
 #if defined(QT_BEGIN_NAMESPACE)
   QT_BEGIN_NAMESPACE
@@ -462,7 +463,7 @@ void WriteInitialization::acceptUI(DomUI *node)
         m_stdsetdef = node->attributeStdSetDef();
 
     const QString className = node->elementClass() + m_option.postfix;
-    m_generatedClass = className;
+    m_generatedClass = QFileInfo(m_option.inputFile).baseName() + m_option.postfix.mid(0, 1).toUpper() + m_option.postfix.mid(1);
 
     m_mainWidget = m_driver->findOrInsertWidget(node->elementWidget());
     m_registeredWidgets.insert(m_mainWidget, node->elementWidget()); // register the main widget
@@ -471,7 +472,7 @@ void WriteInitialization::acceptUI(DomUI *node)
 
     const QString widgetClassName = node->elementWidget()->attributeClass();
 
-    m_output << m_option.indent << "def " << "setupUi(" << m_mainWidget << ")\n";
+    m_output << m_option.indent << m_option.indent << "def " << "setup_ui(" << m_mainWidget << ")\n";
 
     const QStringList connections = m_uic->databaseInfo()->connections();
     for (int i=0; i<connections.size(); ++i) {
@@ -481,7 +482,7 @@ void WriteInitialization::acceptUI(DomUI *node)
             continue;
 
         QString varConn = QLatin1String("@") + connection + QLatin1String("Connection");
-        m_output << m_option.indent << varConn << " = Qt::SqlDatabase.database(" << fixString(connection, m_option.indent) << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << varConn << " = Qt::SqlDatabase.database(" << fixString(connection, m_option.indent) << ")\n";
     }
 
     acceptWidget(node->elementWidget());
@@ -501,7 +502,7 @@ void WriteInitialization::acceptUI(DomUI *node)
             continue;
         }
 
-        m_output << m_option.indent << "@" << name << ".buddy = @" << buddyName << "\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << "@" << name << ".buddy = @" << buddyName << "\n";
     }
 
     if (node->elementTabStops())
@@ -510,7 +511,7 @@ void WriteInitialization::acceptUI(DomUI *node)
     if (m_delayedActionInitialization.size())
         m_output << "\n" << m_delayedActionInitialization;
 
-    m_output << "\n" << m_option.indent << "retranslateUi(" << m_mainWidget << ")\n";
+    m_output << "\n" << m_option.indent << m_option.indent << m_option.indent << "retranslate_ui(" << m_mainWidget << ")\n";
 
     if (node->elementConnections())
         acceptConnections(node->elementConnections());
@@ -519,21 +520,16 @@ void WriteInitialization::acceptUI(DomUI *node)
         m_output << "\n" << m_delayedInitialization << "\n";
 
     if (m_option.autoConnection)
-        m_output << "\n" << m_option.indent << "Qt::MetaObject.connectSlotsByName(" << m_mainWidget << ")\n";
+        m_output << "\n" << m_option.indent << m_option.indent << m_option.indent << "Qt::MetaObject.connectSlotsByName(" << m_mainWidget << ")\n";
 
-    m_output << m_option.indent << "end # setupUi\n\n";
+    m_output << m_option.indent << m_option.indent << "end # setup_ui\n\n";
 
-    m_output << m_option.indent << "def " << "setup_ui(" << m_mainWidget << ")\n";
-    m_output << m_option.indent << "    setupUi(" << m_mainWidget << ")\n";
-    m_output << m_option.indent << "end\n\n";
-
-    m_output << m_option.indent << "def " << "retranslateUi(" << m_mainWidget << ")\n"
+    m_output << m_option.indent << m_option.indent << "def " << "retranslate_ui(" << m_mainWidget << ")\n"
            << m_refreshInitialization
-           << m_option.indent << "end # retranslateUi\n\n";
+           << m_option.indent << m_option.indent << "end # retranslate_ui\n\n";
 
-    m_output << m_option.indent << "def " << "retranslate_ui(" << m_mainWidget << ")\n";
-    m_output << m_option.indent << "    retranslateUi(" << m_mainWidget << ")\n";
-    m_output << m_option.indent << "end\n\n";
+    m_output << m_option.indent << m_option.indent <<"alias " << ":setupUi " << ":setup_ui\n";
+    m_output << m_option.indent << m_option.indent << "alias " << ":retranslateUi " << ":retranslate_ui\n";
 
     m_layoutChain.pop();
     m_widgetChain.pop();
@@ -569,7 +565,7 @@ void WriteInitialization::acceptWidget(DomWidget *node)
         parentWidget.clear();
 
     if (m_widgetChain.size() != 1) {
-        m_output << m_option.indent << varName << " = " << m_driver->rubyClassName(m_uic->customWidgetsInfo()->realClassName(className)) << ".new(" << parentWidget << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << varName << " = " << m_driver->rubyClassName(m_uic->customWidgetsInfo()->realClassName(className)) << ".new(" << parentWidget << ")\n";
     }
 
     parentWidget = savedParentWidget;
@@ -603,11 +599,11 @@ void WriteInitialization::acceptWidget(DomWidget *node)
             if (!m_buttonGroups.contains(groupName)) {
                 m_buttonGroups.insert(groupName, m_driver->findOrInsertName(groupName));
                 const QString g = QString("@") + m_buttonGroups.value(groupName);
-                m_output << m_option.indent << g << " = Qt::ButtonGroup.new(" << m_generatedClass << ")\n";
+                m_output << m_option.indent << m_option.indent << m_option.indent << g << " = Qt::ButtonGroup.new(" << m_generatedClass << ")\n";
             }
 
             const QString g = QString("@") + m_buttonGroups.value(groupName);
-            m_output << m_option.indent << g << ".addButton(" << varName << ")\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << g << ".addButton(" << varName << ")\n";
         }
     }
 
@@ -656,14 +652,14 @@ void WriteInitialization::acceptWidget(DomWidget *node)
 
         if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QMenuBar"))) {
             if (!m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("Q3MainWindow")))
-                m_output << m_option.indent << parentWidget << ".setMenuBar(" << varName <<")\n";
+                m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".setMenuBar(" << varName <<")\n";
         } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QToolBar"))) {
-            m_output << m_option.indent << parentWidget << ".addToolBar("
+            m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addToolBar("
                      << toolBarAreaStringFromDOMAttributes(attributes) << varName << ")\n";
 
             if (const DomProperty *pbreak = attributes.value(QLatin1String("toolBarBreak"))) {
                 if (pbreak->elementBool() == QLatin1String("true")) {
-                    m_output << m_option.indent << parentWidget << ".insertToolBarBreak(" <<  varName << ")\n";
+                    m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".insertToolBarBreak(" <<  varName << ")\n";
                 }
             }
 
@@ -675,36 +671,36 @@ void WriteInitialization::acceptWidget(DomWidget *node)
                 area += QLatin1String("), ");
             }
 
-            m_output << m_option.indent << parentWidget << ".addDockWidget(" << area << varName << ")\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addDockWidget(" << area << varName << ")\n";
         } else if (m_uic->customWidgetsInfo()->extends(className, QLatin1String("QStatusBar"))) {
-            m_output << m_option.indent << parentWidget << ".statusBar = " << varName << "\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".statusBar = " << varName << "\n";
         } else if (className == QLatin1String("QWidget")) {
-            m_output << m_option.indent << parentWidget << ".centralWidget = " << varName << "\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".centralWidget = " << varName << "\n";
         }
     }
 
     // Check for addPageMethod of a custom plugin first
     const QString addPageMethod = m_uic->customWidgetsInfo()->customWidgetAddPageMethod(parentClass);
     if (!addPageMethod.isEmpty()) {
-        m_output << m_option.indent << parentWidget << "." << addPageMethod << '(' << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << "." << addPageMethod << '(' << varName << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QStackedWidget"))) {
-        m_output << m_option.indent << parentWidget << ".addWidget(" << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addWidget(" << varName << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QToolBar"))) {
-        m_output << m_option.indent << parentWidget << ".addWidget(" << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addWidget(" << varName << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("Q3WidgetStack"))) {
-        m_output << m_option.indent << parentWidget << ".addWidget(" << varName << ", " << id << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addWidget(" << varName << ", " << id << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QDockWidget"))) {
-        m_output << m_option.indent << parentWidget << ".setWidget(" << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".setWidget(" << varName << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QScrollArea"))) {
-        m_output << m_option.indent << parentWidget << ".setWidget(" << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".setWidget(" << varName << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QSplitter"))) {
-        m_output << m_option.indent << parentWidget << ".addWidget(" << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addWidget(" << varName << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QMdiArea"))) {
-        m_output << m_option.indent << parentWidget << ".addSubWindow(" << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addSubWindow(" << varName << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QWorkspace"))) {
-        m_output << m_option.indent << parentWidget << ".addWindow(" << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addWindow(" << varName << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QWizard"))) {
-        m_output << m_option.indent << parentWidget << ".addPage(" << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addPage(" << varName << ")\n";
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QToolBox"))) {
         QString icon;
         if (DomProperty *picon = attributes.value(QLatin1String("icon"))) {
@@ -712,13 +708,13 @@ void WriteInitialization::acceptWidget(DomWidget *node)
             icon += iconCall(picon);
         }
 
-        m_output << m_option.indent << parentWidget << ".addItem(" << varName << icon << ", " << trCall(label) << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addItem(" << varName << icon << ", " << trCall(label) << ")\n";
 
-        m_refreshOut << m_option.indent << parentWidget << ".setItemText("
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".setItemText("
                    << parentWidget << ".indexOf(" << varName << "), " << trCall(label) << ")\n";
 
         if (DomProperty *ptoolTip = attributes.value(QLatin1String("toolTip"))) {
-            m_refreshOut << m_option.indent << parentWidget << ".setItemToolTip("
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".setItemToolTip("
                        << parentWidget << ".indexOf(" << varName << "), " << trCall(ptoolTip->elementString()) << ")\n";
         }
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("QTabWidget"))) {
@@ -728,19 +724,19 @@ void WriteInitialization::acceptWidget(DomWidget *node)
             icon += iconCall(picon);
         }
 
-        m_output << m_option.indent << parentWidget << ".addTab(" << varName << icon << ", " << trCall(title) << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addTab(" << varName << icon << ", " << trCall(title) << ")\n";
 
-        m_refreshOut << m_option.indent << parentWidget << ".setTabText("
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".setTabText("
                    << parentWidget << ".indexOf(" << varName << "), " << trCall(title) << ")\n";
 
         if (const DomProperty *ptoolTip = attributes.value(QLatin1String("toolTip"))) {
-            m_refreshOut << m_option.indent << parentWidget << ".setTabToolTip("
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".setTabToolTip("
                        << parentWidget << ".indexOf(" << varName << "), " << trCall(ptoolTip->elementString()) << ")\n";
         }
     } else if (m_uic->customWidgetsInfo()->extends(parentClass, QLatin1String("Q3Wizard"))) {
-        m_output << m_option.indent << parentWidget << ".addPage(" << varName << ", " << trCall(title) << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".addPage(" << varName << ", " << trCall(title) << ")\n";
 
-        m_refreshOut << m_option.indent << parentWidget << ".setTitle("
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << parentWidget << ".setTitle("
                    << varName << ", " << trCall(title) << ")\n";
 
     }
@@ -761,7 +757,7 @@ void WriteInitialization::acceptWidget(DomWidget *node)
             continue;
         }
 
-        m_output << m_option.indent << name << ".raise()\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << name << ".raise()\n";
     }
 }
 
@@ -785,19 +781,19 @@ void WriteInitialization::acceptLayout(DomLayout *node)
             isGroupBox = true;
             // special case for group box
 
-            m_output << m_option.indent << parent << ".setColumnLayout(0, Qt::Vertical)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << parent << ".setColumnLayout(0, Qt::Vertical)\n";
             QString objectName = parent;
             objectName += QLatin1String(".layout");
             int marginType = Use43UiFile;
             if (oldLayoutProperties)
                 marginType = m_layoutMarginType;
 
-            m_LayoutDefaultHandler.writeProperties(m_option.indent, 
+            m_LayoutDefaultHandler.writeProperties((m_option.indent + m_option.indent + m_option.indent),
                                     objectName, properties, marginType, false, m_output);
         }
     }
 
-    m_output << m_option.indent << varName << " = " << m_driver->rubyClassName(className) << ".new(";
+    m_output << m_option.indent << m_option.indent << m_option.indent << varName << " = " << m_driver->rubyClassName(className) << ".new(";
 
     if (!m_layoutChain.top() && !isGroupBox) {
         QString parentWidget = m_driver->findOrInsertWidget(m_widgetChain.top());
@@ -816,22 +812,22 @@ void WriteInitialization::acceptLayout(DomLayout *node)
         widget = widget.mid(0, 1).toLower() + widget.mid(1);
         widget.prepend("@");
       
-        m_output << m_option.indent << "" << tempName << " = " <<
+        m_output << m_option.indent << m_option.indent << m_option.indent << tempName << " = " <<
                     widget << ".layout\n";
-        m_output << m_option.indent << "if " << tempName << "\n";
-        m_output << m_option.indent << "    " << tempName << ".addLayout(" << varName << ")\n";
-        m_output << m_option.indent << "end " << "\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << "if " << tempName << "\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << m_option.indent << tempName << ".addLayout(" << varName << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << "end " << "\n";
     }
 
     if (isGroupBox) {
-        m_output << m_option.indent << varName << ".alignment = Qt::AlignTop\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".alignment = Qt::AlignTop\n";
     } else {
        // Suppress margin on a read child layout
         const bool suppressMarginDefault = m_layoutChain.top();
         int marginType = Use43UiFile;
         if (oldLayoutProperties)
             marginType = m_layoutMarginType;
-        m_LayoutDefaultHandler.writeProperties(m_option.indent, varName, properties, marginType, suppressMarginDefault, m_output);
+        m_LayoutDefaultHandler.writeProperties((m_option.indent + m_option.indent + m_option.indent), varName, properties, marginType, suppressMarginDefault, m_output);
     }
 
     m_layoutMarginType = SubLayoutMargin;
@@ -889,7 +885,7 @@ void WriteInitialization::acceptLayout(DomLayout *node)
 
 void WriteInitialization::acceptSpacer(DomSpacer *node)
 {
-    m_output << m_option.indent << "@" << m_driver->findOrInsertSpacer(node) << " = ";
+    m_output << m_option.indent << m_option.indent << m_option.indent << "@" << m_driver->findOrInsertSpacer(node) << " = ";
     writeSpacerItem(node, m_output);
     m_output << "\n";
 }
@@ -933,7 +929,7 @@ void WriteInitialization::acceptLayoutItem(DomLayoutItem *node)
     }
 
     // figure out "add" method
-    m_output << "\n" << m_option.indent << layoutName << ".";
+    m_output << "\n" << m_option.indent << m_option.indent << m_option.indent << layoutName << ".";
     switch (node->kind()) {
     case DomLayoutItem::Widget:
         m_output << methodPrefix << "Widget(" <<  addArgs;
@@ -964,7 +960,7 @@ void WriteInitialization::acceptActionGroup(DomActionGroup *node)
     if (m_actionGroupChain.top())
         varName = m_driver->findOrInsertActionGroup(m_actionGroupChain.top());
 
-    m_output << m_option.indent << actionName << " = Qt:ActionGroup.new(" << varName << ")\n";
+    m_output << m_option.indent << m_option.indent << m_option.indent << actionName << " = Qt:ActionGroup.new(" << varName << ")\n";
     writeProperties(actionName, QLatin1String("QActionGroup"), node->elementProperty());
 
     m_actionGroupChain.push(node);
@@ -990,7 +986,7 @@ void WriteInitialization::acceptAction(DomAction *node)
         varName = toRubyIdentifier(m_driver->findOrInsertActionGroup(m_actionGroupChain.top()));
     }
 
-    m_output << m_option.indent << actionName << " = Qt::Action.new(" << varName << ")\n";
+    m_output << m_option.indent << m_option.indent << m_option.indent << actionName << " = Qt::Action.new(" << varName << ")\n";
     writeProperties(actionName, QLatin1String("QAction"), node->elementProperty());
 }
 
@@ -1015,7 +1011,7 @@ void WriteInitialization::acceptActionRef(DomActionRef *node)
         isMenu = m_uic->isMenu(w->attributeClass());
         bool inQ3ToolBar = m_uic->customWidgetsInfo()->extends(m_widgetChain.top()->attributeClass(), QLatin1String("Q3ToolBar"));
         if (!isMenu && inQ3ToolBar) {
-            m_actionOut << m_option.indent << rubyActionName << ".parent = " << varName << "\n";
+            m_actionOut << m_option.indent << m_option.indent << m_option.indent << rubyActionName << ".parent = " << varName << "\n";
             return;
         }
     } else if (!(m_driver->actionByName(actionName) || isSeparator)) {
@@ -1025,14 +1021,14 @@ void WriteInitialization::acceptActionRef(DomActionRef *node)
 
     if (m_widgetChain.top() && isSeparator) {
         // separator is always reserved!
-        m_actionOut << m_option.indent << varName << ".addSeparator()\n";
+        m_actionOut << m_option.indent << m_option.indent << m_option.indent << varName << ".addSeparator()\n";
         return;
     }
 
     if (isMenu)
         rubyActionName += QLatin1String(".menuAction()");
 
-    m_actionOut << m_option.indent << varName << ".addAction(" << rubyActionName << ")\n";
+    m_actionOut << m_option.indent << m_option.indent << m_option.indent << varName << ".addAction(" << rubyActionName << ")\n";
 }
 
 void WriteInitialization::writeProperties(const QString &varName,
@@ -1046,28 +1042,23 @@ void WriteInitialization::writeProperties(const QString &varName,
         DomPropertyMap properties = propertyMap(lst);
         if (properties.contains(QLatin1String("control"))) {
             DomProperty *p = properties.value(QLatin1String("control"));
-            m_output << m_option.indent << varName << ".setControl("
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".setControl("
                    << fixString(toString(p->elementString()), m_option.indent) << ")\n";
         }
     }
 
     DomWidget *buttonGroupWidget = findWidget(QLatin1String("Q3ButtonGroup"));
 
-    QString indent;
     if (!m_widgetChain.top()) {
-        indent = QLatin1String("    ");
-        m_output << m_option.indent << "if " << varName << ".objectName.nil?\n";
-    }
-
-    if (varName.startsWith("@")) {
-        m_output << m_option.indent << indent << varName << ".objectName = " << fixString(varName.mid(1), m_option.indent) << "\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << "if " << varName << ".objectName.nil?\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << m_option.indent << varName << ".objectName = \"" << m_generatedClass << "\"\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << "end\n";
     } else {
-        m_output << m_option.indent << indent << varName << ".objectName = " << fixString(varName.mid(0,1).toLower() + varName.mid(1), m_option.indent) << "\n";
-    }
-
-    if (!m_widgetChain.top()) {
-        indent = QLatin1String("    ");
-        m_output << m_option.indent << "end\n";
+        if (varName.startsWith("@")) {
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".objectName = " << fixString(varName.mid(1), m_option.indent) << "\n";
+        } else {
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".objectName = " << fixString(varName.mid(0,1).toLower() + varName.mid(1), m_option.indent) << "\n";
+        }
     }
 
     int leftMargin, topMargin, rightMargin, bottomMargin;
@@ -1084,15 +1075,15 @@ void WriteInitialization::writeProperties(const QString &varName,
         // special case for the property `geometry': Do not use position
         if (isTopLevel && propertyName == QLatin1String("geometry") && p->elementRect()) {
             const DomRect *r = p->elementRect();
-            m_output << m_option.indent << varName << ".resize(" << r->elementWidth() << ", " << r->elementHeight() << ")\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".resize(" << r->elementWidth() << ", " << r->elementHeight() << ")\n";
             continue;
         } else if (propertyName == QLatin1String("buttonGroupId") && buttonGroupWidget) { // Q3ButtonGroup support
-            m_output << m_option.indent << m_driver->findOrInsertWidget(buttonGroupWidget) << ".insert("
+            m_output << m_option.indent << m_option.indent << m_option.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"))) {
-            m_delayedOut << m_option.indent << varName << ".setCurrentRow("
+            m_delayedOut << m_option.indent << m_option.indent << m_option.indent << varName << ".setCurrentRow("
                        << p->elementNumber() << ")\n";
             continue;
         } else if (propertyName == QLatin1String("currentIndex") // set currentIndex later
@@ -1100,12 +1091,12 @@ void WriteInitialization::writeProperties(const QString &varName,
                     || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QStackedWidget"))
                     || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QTabWidget"))
                     || m_uic->customWidgetsInfo()->extends(className, QLatin1String("QToolBox")))) {
-            m_delayedOut << m_option.indent << varName << ".setCurrentIndex("
+            m_delayedOut << m_option.indent << m_option.indent << m_option.indent << varName << ".setCurrentIndex("
                        << p->elementNumber() << ")\n";
             continue;
         } else if (propertyName == QLatin1String("tabSpacing")
                     && m_uic->customWidgetsInfo()->extends(className, QLatin1String("QToolBox"))) {
-            m_delayedOut << m_option.indent << varName << ".layout().setSpacing("
+            m_delayedOut << m_option.indent << m_option.indent << m_option.indent << varName << ".layout().setSpacing("
                        << p->elementNumber() << ")\n";
             continue;
         } else if (propertyName == QLatin1String("control") // ActiveQt support
@@ -1127,10 +1118,10 @@ void WriteInitialization::writeProperties(const QString &varName,
             if (p->elementEnum() == QLatin1String("Qt::Vertical"))
                 shape = QLatin1String("Qt::Frame::VLine");
 
-            m_output << m_option.indent << varName << ".setFrameShape(" << shape << ")\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".setFrameShape(" << shape << ")\n";
             // QFrame Default is 'Plain'. Make the line 'Sunken' unless otherwise specified
             if (!frameShadowEncountered)
-                m_output << m_option.indent << varName << ".setFrameShadow(Qt::Frame::Sunken)\n";
+                m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".setFrameShadow(Qt::Frame::Sunken)\n";
             continue;
         } else if ((flags & WritePropertyIgnoreMargin)  && propertyName == QLatin1String("margin")) {
             continue;
@@ -1228,7 +1219,7 @@ void WriteInitialization::writeProperties(const QString &varName,
         case DomProperty::Palette: {
             DomPalette *pal = p->elementPalette();
             QString paletteName = QString("@") + m_driver->unique(QLatin1String("palette"));
-            m_output << m_option.indent << paletteName << " = Qt::Palette.new\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << paletteName << " = Qt::Palette.new\n";
 
             writeColorGroup(pal->elementActive(), QLatin1String("Qt::Palette::Active"), paletteName);
             writeColorGroup(pal->elementInactive(), QLatin1String("Qt::Palette::Inactive"), paletteName);
@@ -1271,7 +1262,7 @@ void WriteInitialization::writeProperties(const QString &varName,
         }
         case DomProperty::SizePolicy: {
             const QString spName = writeSizePolicy( p->elementSizePolicy());
-            m_output << m_option.indent << spName << QString::fromLatin1(
+            m_output << m_option.indent << m_option.indent << m_option.indent << spName << QString::fromLatin1(
                 ".heightForWidth = %1.sizePolicy.hasHeightForWidth\n")
                 .arg(varName);
 
@@ -1387,7 +1378,7 @@ void WriteInitialization::writeProperties(const QString &varName,
         
             QTextStream &o = needsTranslation ? m_refreshOut : m_output;
 
-            o << m_option.indent << varNewName << setFunction << propertyValue;
+            o << m_option.indent << m_option.indent << m_option.indent << varNewName << setFunction << propertyValue;
             if (!stdset) {
                 o << "))";
             }
@@ -1404,7 +1395,7 @@ void WriteInitialization::writeProperties(const QString &varName,
                 objectName = m_driver->findOrInsertWidget(m_widgetChain.top()) + QLatin1String(".layout()");
             }
         }
-        m_output << m_option.indent << objectName << QLatin1String(".setContentsMargins(")
+        m_output << m_option.indent << m_option.indent << m_option.indent << objectName << QLatin1String(".setContentsMargins(")
                  << leftMargin << QLatin1String(", ")
                  << topMargin << QLatin1String(", ")
                  << rightMargin << QLatin1String(", ")
@@ -1427,7 +1418,7 @@ QString  WriteInitialization::writeSizePolicy(const DomSizePolicy *sp)
     const QString spName = QString("@") + m_driver->unique(QLatin1String("sizePolicy"));
     m_sizePolicyNameMap.insert(sizePolicyHandle, spName);
 
-    m_output << m_option.indent << spName << " = Qt::SizePolicy.new";
+    m_output << m_option.indent << m_option.indent << m_option.indent << spName << " = Qt::SizePolicy.new";
     do {
         if (sp->hasElementHSizeType() && sp->hasElementVSizeType()) {
             m_output << "(" << sp->elementHSizeType()
@@ -1442,9 +1433,9 @@ QString  WriteInitialization::writeSizePolicy(const DomSizePolicy *sp)
         m_output << "\n";
     } while (false);
 
-    m_output << m_option.indent << spName << ".setHorizontalStretch("
+    m_output << m_option.indent << m_option.indent << m_option.indent << spName << ".setHorizontalStretch("
         << sp->elementHorStretch() << ")\n";
-    m_output << m_option.indent << spName << ".setVerticalStretch("
+    m_output << m_option.indent << m_option.indent << m_option.indent << spName << ".setVerticalStretch("
         << sp->elementVerStretch() << ")\n";
     return spName;
 }
@@ -1464,46 +1455,46 @@ QString WriteInitialization::writeFontProperties(const DomFont *f)
     const QString fontName = QString("@") + m_driver->unique(QLatin1String("font"));
     m_fontPropertiesNameMap.insert(FontHandle(f), fontName);
 
-    m_output << m_option.indent << fontName << " = Qt::Font.new\n";
+    m_output << m_option.indent << m_option.indent << m_option.indent << fontName << " = Qt::Font.new\n";
     if (f->hasElementFamily() && !f->elementFamily().isEmpty()) {
-        m_output << m_option.indent << fontName << ".family = " << fixString(f->elementFamily(), m_option.indent)
+        m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".family = " << fixString(f->elementFamily(), m_option.indent)
             << "\n";
     }
     if (f->hasElementPointSize() && f->elementPointSize() > 0) {
-         m_output << m_option.indent << fontName << ".pointSize = " << f->elementPointSize()
+         m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".pointSize = " << f->elementPointSize()
              << "\n";
     }
 
     if (f->hasElementBold()) {
-        m_output << m_option.indent << fontName << ".bold = "
+        m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".bold = "
             << (f->elementBold() ? "true" : "false") << "\n";
     }
     if (f->hasElementItalic()) {
-        m_output << m_option.indent << fontName << ".italic = "
+        m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".italic = "
             <<  (f->elementItalic() ? "true" : "false") << "\n";
     }
     if (f->hasElementUnderline()) {
-        m_output << m_option.indent << fontName << ".underline = "
+        m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".underline = "
             << (f->elementUnderline() ? "true" : "false") << "\n";
     }
     if (f->hasElementWeight() && f->elementWeight() > 0) {
-        m_output << m_option.indent << fontName << ".weight = "
+        m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".weight = "
             << f->elementWeight() << "" << endl;
     }
     if (f->hasElementStrikeOut()) {
-         m_output << m_option.indent << fontName << ".strikeOut = "
+         m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".strikeOut = "
             << (f->elementStrikeOut() ? "true" : "false") << "\n";
     }
     if (f->hasElementKerning()) {
-        m_output << m_option.indent << fontName << ".kerning = "
+        m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".kerning = "
             << (f->elementKerning() ? "true" : "false") << "\n";
     }
     if (f->hasElementAntialiasing()) {
-        m_output << m_option.indent << fontName << ".styleStrategy = "
+        m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".styleStrategy = "
             << (f->elementAntialiasing() ? "Qt::Font::PreferDefault" : "Qt::Font::NoAntialias") << "\n";
     }
     if (f->hasElementStyleStrategy()) {
-         m_output << m_option.indent << fontName << ".styleStrategy = Qt::Font::"
+         m_output << m_option.indent << m_option.indent << m_option.indent << fontName << ".styleStrategy = Qt::Font::"
             << f->elementStyleStrategy() << "\n";
     }
     return  fontName;
@@ -1523,25 +1514,25 @@ QString WriteInitialization::writeIconProperties(const DomResourceIcon *i)
     m_iconPropertiesNameMap.insert(IconHandle(i), iconName);
     if (isIconFormat44(i)) {
         const QString pixmap = QLatin1String("Qt::Pixmap.new");
-        m_output << m_option.indent << iconName << " = Qt::Icon.new\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << iconName << " = Qt::Icon.new\n";
         if (i->hasElementNormalOff())
-            m_output << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementNormalOff()->text()) << ", Qt::Icon::Normal, Qt::Icon::Off)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementNormalOff()->text()) << ", Qt::Icon::Normal, Qt::Icon::Off)\n";
         if (i->hasElementNormalOn())
-            m_output << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementNormalOn()->text()) << ", Qt::Icon::Normal, Qt::Icon::On)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementNormalOn()->text()) << ", Qt::Icon::Normal, Qt::Icon::On)\n";
         if (i->hasElementDisabledOff())
-            m_output << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementDisabledOff()->text()) << ", Qt::Icon::Disabled, Qt::Icon::Off)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementDisabledOff()->text()) << ", Qt::Icon::Disabled, Qt::Icon::Off)\n";
         if (i->hasElementDisabledOn())
-            m_output << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementDisabledOn()->text()) << ", Qt::Icon::Disabled, Qt::Icon::On)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementDisabledOn()->text()) << ", Qt::Icon::Disabled, Qt::Icon::On)\n";
         if (i->hasElementActiveOff())
-            m_output << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementActiveOff()->text()) << ", Qt::Icon::Active, Qt::Icon::Off)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementActiveOff()->text()) << ", Qt::Icon::Active, Qt::Icon::Off)\n";
         if (i->hasElementActiveOn())
-            m_output << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementActiveOn()->text()) << ", Qt::Icon::Active, Qt::Icon::On)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementActiveOn()->text()) << ", Qt::Icon::Active, Qt::Icon::On)\n";
         if (i->hasElementSelectedOff())
-            m_output << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementSelectedOff()->text()) << ", Qt::Icon::Selected, Qt::Icon::Off)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementSelectedOff()->text()) << ", Qt::Icon::Selected, Qt::Icon::Off)\n";
         if (i->hasElementSelectedOn())
-            m_output << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementSelectedOn()->text()) << ", Qt::Icon::Selected, Qt::Icon::On)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << iconName << ".addPixmap(" << pixCall(pixmap, i->elementSelectedOn()->text()) << ", Qt::Icon::Selected, Qt::Icon::On)\n";
     } else { // pre-4.4 legacy
-        m_output <<  m_option.indent << iconName << " = " << pixCall(QLatin1String("Qt::Icon.new"), i->text())<< "\n";
+        m_output <<  m_option.indent <<  m_option.indent <<  m_option.indent << iconName << " = " << pixCall(QLatin1String("Qt::Icon.new"), i->text())<< "\n";
     }
     return iconName;
 }
@@ -1570,7 +1561,7 @@ void WriteInitialization::writeColorGroup(DomColorGroup *colorGroup, const QStri
     for (int i=0; i<colors.size(); ++i) {
         DomColor *color = colors.at(i);
 
-        m_output << m_option.indent << paletteName << ".setColor(" << group
+        m_output << m_option.indent << m_option.indent << m_option.indent << paletteName << ".setColor(" << group
             << ", " << i 
             << ", " << domColor2QString(color)
             << ")\n";
@@ -1583,7 +1574,7 @@ void WriteInitialization::writeColorGroup(DomColorGroup *colorGroup, const QStri
         const DomColorRole *colorRole = itRole.next();
         if (colorRole->hasAttributeRole()) {
             const QString brushName = writeBrushInitialization(colorRole->elementBrush());
-            m_output << m_option.indent << paletteName << ".setBrush(" << group
+            m_output << m_option.indent << m_option.indent << m_option.indent << paletteName << ".setBrush(" << group
                 << ", " << "Qt::Palette::" << colorRole->attributeRole()
                 << ", " << brushName << ")\n";
         }
@@ -1628,30 +1619,30 @@ void WriteInitialization::writeBrush(const DomBrush *brush, const QString &brush
         QString gradientType = gradient->attributeType();
         QString gradientName = m_driver->unique(QLatin1String("gradient"));
         if (gradientType == QLatin1String("LinearGradient")) {
-            m_output << m_option.indent << gradientName << " = Qt::LinearGradient.new" 
+            m_output << m_option.indent << m_option.indent << m_option.indent << gradientName << " = Qt::LinearGradient.new"
                 << "(" << gradient->attributeStartX()
                 << ", " << gradient->attributeStartY()
                 << ", " << gradient->attributeEndX()
                 << ", " << gradient->attributeEndY() << ")\n";
         } else if (gradientType == QLatin1String("RadialGradient")) {
-            m_output << m_option.indent << gradientName << " = Qt::RadialGradient.new" 
+            m_output << m_option.indent << m_option.indent << m_option.indent << gradientName << " = Qt::RadialGradient.new"
                 << "(" << gradient->attributeCentralX()
                 << ", " << gradient->attributeCentralY()
                 << ", " << gradient->attributeRadius()
                 << ", " << gradient->attributeFocalX()
                 << ", " << gradient->attributeFocalY() << ")\n";
         } else if (gradientType == QLatin1String("ConicalGradient")) {
-            m_output << m_option.indent << gradientName << " = Qt::ConicalGradient.new"
+            m_output << m_option.indent << m_option.indent << m_option.indent << gradientName << " = Qt::ConicalGradient.new"
                 << "(" << gradient->attributeCentralX()
                 << ", " << gradient->attributeCentralY()
                 << ", " << gradient->attributeAngle() << ")\n";
         }
 
-        m_output << m_option.indent << gradientName << ".spread = Qt::Gradient::"
+        m_output << m_option.indent << m_option.indent << m_option.indent << gradientName << ".spread = Qt::Gradient::"
             << gradient->attributeSpread() << "\n";
 
         if (gradient->hasAttributeCoordinateMode()) {
-            m_output << m_option.indent << gradientName << ".coordinateMode = Qt::Gradient::"
+            m_output << m_option.indent << m_option.indent << m_option.indent << gradientName << ".coordinateMode = Qt::Gradient::"
                 << gradient->attributeCoordinateMode() << "\n";
         }
 
@@ -1660,23 +1651,23 @@ void WriteInitialization::writeBrush(const DomBrush *brush, const QString &brush
         while (it.hasNext()) {
             const DomGradientStop *stop = it.next();
             const DomColor *color = stop->elementColor();
-            m_output << m_option.indent << gradientName << ".setColorAt("
+            m_output << m_option.indent << m_option.indent << m_option.indent << gradientName << ".setColorAt("
                 << stop->attributePosition() << ", "
                 << domColor2QString(color) << ")\n";
         }
-        m_output << m_option.indent << brushName << " = Qt::Brush.new" << "("
+        m_output << m_option.indent << m_option.indent << m_option.indent << brushName << " = Qt::Brush.new" << "("
             << gradientName << ")\n";
     } else if (style == QLatin1String("TexturePattern")) {
         DomProperty *property = brush->elementTexture();
 
-        m_output << m_option.indent << brushName << " = Qt::Brush.new" <<  "("
+        m_output << m_option.indent << m_option.indent << m_option.indent << brushName << " = Qt::Brush.new" <<  "("
             << pixCall(property) << ")\n";
     } else {
         DomColor *color = brush->elementColor();
-        m_output << m_option.indent << brushName << " = Qt::Brush.new" <<  "("
+        m_output << m_option.indent << m_option.indent << m_option.indent << brushName << " = Qt::Brush.new" <<  "("
             << domColor2QString(color) << ")\n";
 
-        m_output << m_option.indent << brushName << ".style = "
+        m_output << m_option.indent << m_option.indent << m_option.indent << brushName << ".style = "
             << "Qt::" << style << "\n";
     }
 }
@@ -1711,7 +1702,7 @@ void WriteInitialization::acceptTabStops(DomTabStops *tabStops)
             continue;
         }
 
-        m_output << m_option.indent << "Qt::Widget.setTabOrder(@" << lastName << ", @" << name << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << "Qt::Widget.setTabOrder(@" << lastName << ", @" << name << ")\n";
 
         lastName = name;
     }
@@ -1727,7 +1718,7 @@ void WriteInitialization::initializeQ3ListBox(DomWidget *w)
     if (items.isEmpty())
         return;
 
-    m_refreshOut << m_option.indent << varName << ".clear()\n";
+    m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".clear()\n";
 
     for (int i=0; i<items.size(); ++i) {
         DomItem *item = items.at(i);
@@ -1738,7 +1729,7 @@ void WriteInitialization::initializeQ3ListBox(DomWidget *w)
         if (!(text || pixmap))
             continue;
 
-        m_refreshOut << m_option.indent << varName << ".insertItem(";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".insertItem(";
         if (pixmap) {
             m_refreshOut << pixCall(pixmap);
 
@@ -1761,7 +1752,7 @@ void WriteInitialization::initializeQ3IconView(DomWidget *w)
     if (items.isEmpty())
         return;
 
-    m_refreshOut << m_option.indent << varName << ".clear()\n";
+    m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".clear()\n";
 
     for (int i=0; i<items.size(); ++i) {
         DomItem *item = items.at(i);
@@ -1774,14 +1765,14 @@ void WriteInitialization::initializeQ3IconView(DomWidget *w)
 
         QString itemName = m_driver->unique(QLatin1String("__item"));
         m_refreshOut << "\n";
-        m_refreshOut << m_option.indent << itemName << " = Qt::3IconViewItem.new(" << varName << ")\n";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << " = Qt::3IconViewItem.new(" << varName << ")\n";
 
         if (pixmap) {
-            m_refreshOut << m_option.indent << itemName << ".pixmap = " << pixCall(pixmap) << "\n";
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".pixmap = " << pixCall(pixmap) << "\n";
         }
 
         if (text) {
-            m_refreshOut << m_option.indent << itemName << ".text = " << trCall(text->elementString()) << "\n";
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".text = " << trCall(text->elementString()) << "\n";
         }
     }
 }
@@ -1803,25 +1794,25 @@ void WriteInitialization::initializeQ3ListView(DomWidget *w)
         const DomProperty *resizable = properties.value(QLatin1String("resizable"));
 
         QString txt = trCall(text->elementString());
-        m_output << m_option.indent << varName << ".addColumn(" << txt << ")\n";
-        m_refreshOut << m_option.indent << varName << ".header.setLabel(" << i << ", " << txt << ")\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".addColumn(" << txt << ")\n";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".header.setLabel(" << i << ", " << txt << ")\n";
 
         if (pixmap) {
-            m_output << m_option.indent << varName << ".header.setLabel("
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".header.setLabel("
                    << varName << ".header.count - 1, " << pixCall(pixmap) << ", " << txt << ")\n";
         }
 
         if (clickable != 0) {
-            m_output << m_option.indent << varName << ".header.setClickEnabled(" << clickable->elementBool() << ", " << varName << ".header().count() - 1)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".header.setClickEnabled(" << clickable->elementBool() << ", " << varName << ".header().count() - 1)\n";
         }
 
         if (resizable != 0) {
-            m_output << m_option.indent << varName << ".header.setResizeEnabled(" << resizable->elementBool() << ", " << varName << ".header().count() - 1)\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".header.setResizeEnabled(" << resizable->elementBool() << ", " << varName << ".header().count() - 1)\n";
         }
     }
 
     if (w->elementItem().size()) {
-        m_refreshOut << m_option.indent << varName << ".clear\n";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".clear\n";
 
         initializeQ3ListViewItems(className, varName, w->elementItem());
     }
@@ -1838,23 +1829,23 @@ void WriteInitialization::initializeQ3ListViewItems(const QString &className, co
 
         QString itemName = m_driver->unique(QLatin1String("__item"));
         m_refreshOut << "\n";
-        m_refreshOut << m_option.indent << itemName << " = new Qt3::ListViewItem.new(" << varName << ")\n";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << " = new Qt3::ListViewItem.new(" << varName << ")\n";
 
         int textCount = 0, pixCount = 0;
         const DomPropertyList properties = item->elementProperty();
         for (int i=0; i<properties.size(); ++i) {
             const DomProperty *p = properties.at(i);
             if (p->attributeName() == QLatin1String("text"))
-                m_refreshOut << m_option.indent << itemName << ".setText(" << textCount++ << ", "
+                m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".setText(" << textCount++ << ", "
                            << trCall(p->elementString()) << ")\n";
 
             if (p->attributeName() == QLatin1String("pixmap"))
-                m_refreshOut << m_option.indent << itemName << ".setPixmap(" << pixCount++ << ", "
+                m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".setPixmap(" << pixCount++ << ", "
                            << pixCall(p) << ")\n";
         }
 
         if (item->elementItem().size()) {
-            m_refreshOut << m_option.indent << itemName << ".open = true\n";
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".open = true\n";
             initializeQ3ListViewItems(className, itemName, item->elementItem());
         }
     }
@@ -1875,7 +1866,7 @@ void WriteInitialization::initializeQ3Table(DomWidget *w)
         const DomProperty *text = properties.value(QLatin1String("text"));
         const DomProperty *pixmap = properties.value(QLatin1String("pixmap"));
 
-        m_refreshOut << m_option.indent << varName << ".horizontalHeader.setLabel(" << i << ", ";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".horizontalHeader.setLabel(" << i << ", ";
         if (pixmap) {
             m_refreshOut << pixCall(pixmap) << ", ";
         }
@@ -1891,7 +1882,7 @@ void WriteInitialization::initializeQ3Table(DomWidget *w)
         const DomProperty *text = properties.value(QLatin1String("text"));
         const DomProperty *pixmap = properties.value(QLatin1String("pixmap"));
 
-        m_refreshOut << m_option.indent << varName << ".verticalHeader.setLabel(" << i << ", ";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".verticalHeader.setLabel(" << i << ", ";
         if (pixmap) {
             m_refreshOut << pixCall(pixmap) << ", ";
         }
@@ -1999,11 +1990,11 @@ void WriteInitialization::initializeComboBox(DomWidget *w)
     }
 
     if (noIcons) {
-        m_refreshOut << m_option.indent << varName << ".insertItems(0, [" ;
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".insertItems(0, [" ;
         for (int i = 0; i < list.size(); ++i) {
             m_refreshOut << list.at(i);
             if (i != (list.size() - 1)) {
-                m_refreshOut << ",\n" << m_option.indent << m_option.indent;
+                m_refreshOut << ",\n" << m_option.indent << m_option.indent << m_option.indent << m_option.indent;
             }
         }
         m_refreshOut << "])\n";
@@ -2018,13 +2009,13 @@ void WriteInitialization::initializeComboBox(DomWidget *w)
             if (icon)
                 iconValue = iconCall(icon);
 
-            m_output << m_option.indent << varName << ".addItem(";
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".addItem(";
             if (icon)
                 m_output << iconValue << ", ";
             m_output << "\"\")\n";
 
             if (!toString(text->elementString()).isEmpty())
-                m_refreshOut << m_option.indent << varName << ".setItemText(" << i << ", " << trCall(text->elementString()) << ")\n";
+                m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".setItemText(" << i << ", " << trCall(text->elementString()) << ")\n";
         }
         m_refreshOut << "\n";
     }
@@ -2037,9 +2028,9 @@ QString WriteInitialization::disableSorting(DomWidget *w, const QString &varName
     if (!w->elementItem().isEmpty()) {
         tempName = m_driver->unique(QLatin1String("__sortingEnabled"));
         m_refreshOut << "\n";
-        m_refreshOut << m_option.indent << tempName
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << tempName
             << " = " << varName << ".sortingEnabled?\n";
-        m_refreshOut << m_option.indent << varName << ".sortingEnabled = false\n";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".sortingEnabled = false\n";
     }
     return tempName;
 }
@@ -2048,7 +2039,7 @@ void WriteInitialization::enableSorting(DomWidget *w, const QString &varName, co
 {
     if (!w->elementItem().isEmpty()) {
         m_refreshOut << "\n";
-        m_refreshOut << m_option.indent << varName << ".sortingEnabled = " << tempName << "\n";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".sortingEnabled = " << tempName << "\n";
     }
 }
 
@@ -2075,14 +2066,14 @@ void WriteInitialization::initializeListWidget(DomWidget *w)
         if (icon) {
             const QString iconValue = iconCall(icon);
             const QString itemName = m_driver->unique(QLatin1String("__listItem"));
-            m_output << m_option.indent << itemName << " = " << itemCreation;
-            m_output << m_option.indent << itemName << ".icon = " << iconValue << "\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << itemName << " = " << itemCreation;
+            m_output << m_option.indent << m_option.indent << m_option.indent << itemName << ".icon = " << iconValue << "\n";
         } else {
-            m_output << m_option.indent << itemCreation;
+            m_output << m_option.indent << m_option.indent << m_option.indent << itemCreation;
         }
 
         if (!toString(text->elementString()).isEmpty()) {
-            m_refreshOut << m_option.indent << varName << ".item(" << i << ").text = " << trCall(text->elementString()) << "\n";
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".item(" << i << ").text = " << trCall(text->elementString()) << "\n";
         }
     }
     enableSorting(w, varName, tempName);
@@ -2104,12 +2095,12 @@ void WriteInitialization::initializeTreeWidget(DomWidget *w)
 
         if (!toString(text->elementString()).isEmpty()) {
             const QString txt = trCall(text->elementString());
-            m_refreshOut << m_option.indent << varName << ".headerItem.setText(" << i << ", " << txt << ")\n";
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".headerItem.setText(" << i << ", " << txt << ")\n";
         }
 
         if (icon) {
             const QString iconValue = iconCall(icon);
-            m_output << m_option.indent << varName << ".headerItem.setIcon("
+            m_output << m_option.indent << m_option.indent << m_option.indent << varName << ".headerItem.setIcon("
                    << i << ", " << iconValue << ")\n";
         }
     }
@@ -2139,7 +2130,7 @@ void WriteInitialization::initializeTreeWidgetItems(const QString &className, co
             const DomProperty *p = properties.at(j);
             if (p->attributeName() == QLatin1String("text")) {
                 if (!toString(p->elementString()).isEmpty()) {
-                    m_refreshOut << m_option.indent << parentPath << i << ").setText(" << textCount << ", "
+                    m_refreshOut << m_option.indent << m_option.indent << m_option.indent << parentPath << i << ").setText(" << textCount << ", "
                         << trCall(p->elementString()) << ")\n";
                 }
                 textCount++;
@@ -2153,14 +2144,14 @@ void WriteInitialization::initializeTreeWidgetItems(const QString &className, co
             }
         }
         if (icons.isEmpty() && (item->elementItem().size() == 0)) {
-            m_output << m_option.indent << "Qt::TreeWidgetItem.new(" << varName << ")\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << "Qt::TreeWidgetItem.new(" << varName << ")\n";
         } else {
             const QString itemName = m_driver->unique(QLatin1String("__treeItem"));
-            m_output << m_option.indent << itemName << " = Qt::TreeWidgetItem.new(" << varName << ")\n";
+            m_output << m_option.indent << m_option.indent << m_option.indent << itemName << " = Qt::TreeWidgetItem.new(" << varName << ")\n";
 
             QStringListIterator it(icons);
             while (it.hasNext())
-                m_output << m_option.indent << itemName << it.next();
+                m_output << m_option.indent << m_option.indent << m_option.indent << itemName << it.next();
 
             if (item->elementItem().size()) {
                 const QString childPath = parentPath + QString::number(i) + QLatin1String(").child(");
@@ -2181,9 +2172,9 @@ void WriteInitialization::initializeTableWidget(DomWidget *w)
     QList<DomColumn *> columns = w->elementColumn();
 
     if (columns.size() != 0) {
-        m_refreshOut << m_option.indent << "if " << varName << ".columnCount < " << columns.size() << "\n"
-            << m_option.indent << m_option.indent << varName << ".columnCount = " << columns.size() << "\n"
-            << m_option.indent << "end\n";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << "if " << varName << ".columnCount < " << columns.size() << "\n"
+            << m_option.indent << m_option.indent << m_option.indent << m_option.indent << varName << ".columnCount = " << columns.size() << "\n"
+            << m_option.indent << m_option.indent << m_option.indent << "end\n";
     }
 
     for (int i = 0; i < columns.size(); ++i) {
@@ -2195,17 +2186,17 @@ void WriteInitialization::initializeTableWidget(DomWidget *w)
         if (text || icon) {
             QString itemName = m_driver->unique(QLatin1String("__colItem"));
             m_refreshOut << "\n";
-            m_refreshOut << m_option.indent 
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent
                            << itemName << " = Qt::TableWidgetItem.new\n";
 
             if (text && text->attributeName() == QLatin1String("text"))
-                m_refreshOut << m_option.indent << itemName << ".setText("
+                m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".setText("
                            << trCall(text->elementString()) << ")\n";
 
             if (icon && icon->attributeName() == QLatin1String("icon"))
-                m_refreshOut << m_option.indent << itemName << ".setIcon("
+                m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".setIcon("
                            << pixCall(icon) << ")\n";
-            m_refreshOut << m_option.indent << varName << ".setHorizontalHeaderItem("
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".setHorizontalHeaderItem("
                            << i << ", " << itemName << ")\n";
         }
     }
@@ -2214,9 +2205,9 @@ void WriteInitialization::initializeTableWidget(DomWidget *w)
     QList<DomRow *> rows = w->elementRow();
 
     if (rows.size() != 0) {
-        m_refreshOut << m_option.indent << "if " << varName << ".rowCount < " << rows.size() << "\n"
-            << m_option.indent << m_option.indent << varName << ".rowCount = " << rows.size() << "\n"
-            << m_option.indent << "end\n";
+        m_refreshOut << m_option.indent << m_option.indent << m_option.indent << "if " << varName << ".rowCount < " << rows.size() << "\n"
+            << m_option.indent << m_option.indent << m_option.indent << m_option.indent << varName << ".rowCount = " << rows.size() << "\n"
+            << m_option.indent << m_option.indent << m_option.indent << "end\n";
     }
 
     for (int i = 0; i < rows.size(); ++i) {
@@ -2228,17 +2219,17 @@ void WriteInitialization::initializeTableWidget(DomWidget *w)
         if (text || icon) {
             QString itemName = m_driver->unique(QLatin1String("__rowItem"));
             m_refreshOut << "\n";
-            m_refreshOut << m_option.indent
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent
                            << itemName << " = Qt::TableWidgetItem.new\n";
 
             if (text && text->attributeName() == QLatin1String("text"))
-                m_refreshOut << m_option.indent << itemName << ".setText("
+                m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".setText("
                            << trCall(text->elementString()) << ")\n";
 
             if (icon && icon->attributeName() == QLatin1String("icon"))
-                m_refreshOut << m_option.indent << itemName << ".setIcon("
+                m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".setIcon("
                            << pixCall(icon) << ")\n";
-            m_refreshOut << m_option.indent << varName << ".setVerticalHeaderItem("
+            m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".setVerticalHeaderItem("
                            << i << ", " << itemName << ")\n";
         }
     }
@@ -2254,17 +2245,17 @@ void WriteInitialization::initializeTableWidget(DomWidget *w)
             if (text || icon) {
                 QString itemName = m_driver->unique(QLatin1String("__item"));
                 m_refreshOut << "\n";
-                m_refreshOut << m_option.indent
+                m_refreshOut << m_option.indent << m_option.indent << m_option.indent
                     << itemName << " = Qt::TableWidgetItem.new\n";
 
                 if (text && text->attributeName() == QLatin1String("text"))
-                    m_refreshOut << m_option.indent << itemName << ".setText("
+                    m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".setText("
                         << trCall(text->elementString()) << ")\n";
 
                 if (icon && icon->attributeName() == QLatin1String("icon"))
-                    m_refreshOut << m_option.indent << itemName << ".setIcon("
+                    m_refreshOut << m_option.indent << m_option.indent << m_option.indent << itemName << ".setIcon("
                         << pixCall(icon) << ")\n";
-                m_refreshOut << m_option.indent << varName << ".setItem("
+                m_refreshOut << m_option.indent << m_option.indent << m_option.indent << varName << ".setItem("
                     << item->attributeRow() << ", "
                     << item->attributeColumn() << ", "
                     << itemName << ")\n";
@@ -2330,17 +2321,17 @@ void WriteInitialization::initializeQ3SqlDataTable(DomWidget *w)
 
     QString varName = toRubyIdentifier(m_driver->findOrInsertWidget(w));
 
-    m_output << m_option.indent << "if !" << varName << ".sqlCursor.nil?\n";
+    m_output << m_option.indent << m_option.indent << m_option.indent << "if !" << varName << ".sqlCursor.nil?\n";
 
-    m_output << m_option.indent << m_option.indent << varName << ".setSqlCursor(";
+    m_output << m_option.indent << m_option.indent << m_option.indent << m_option.indent << varName << ".setSqlCursor(";
 
     if (connection == QLatin1String("(default)")) {
         m_output << "Qt3::SqlCursor.new(" << fixString(table, m_option.indent) << "), false, true)\n";
     } else {
         m_output << "Qt3::SqlCursor.new(" << fixString(table, m_option.indent) << ", true, " << connection << "Connection" << "), false, true)\n";
     }
-    m_output << m_option.indent << m_option.indent  << varName << ".refresh(Qt3::DataTable::RefreshAll)\n";
-    m_output << m_option.indent << "end\n";
+    m_output << m_option.indent << m_option.indent << m_option.indent << m_option.indent  << varName << ".refresh(Qt3::DataTable::RefreshAll)\n";
+    m_output << m_option.indent << m_option.indent << m_option.indent << "end\n";
 }
 
 void WriteInitialization::initializeQ3SqlDataBrowser(DomWidget *w)
@@ -2370,17 +2361,17 @@ void WriteInitialization::initializeQ3SqlDataBrowser(DomWidget *w)
 
     QString varName = toRubyIdentifier(m_driver->findOrInsertWidget(w));
 
-    m_output << m_option.indent << "if !" << varName << ".sqlCursor.nil?\n";
+    m_output << m_option.indent << m_option.indent << m_option.indent << "if !" << varName << ".sqlCursor.nil?\n";
 
-    m_output << m_option.indent << m_option.indent << varName << ".setSqlCursor(";
+    m_output << m_option.indent << m_option.indent << m_option.indent << m_option.indent << varName << ".setSqlCursor(";
 
     if (connection == QLatin1String("(default)")) {
         m_output << "Qt::SqlCursor.new(" << fixString(table, m_option.indent) << "), true)\n";
     } else {
         m_output << "Qt::SqlCursor.new(" << fixString(table, m_option.indent) << ", true, " << connection << "Connection" << "), false, true)\n";
     }
-    m_output << m_option.indent << m_option.indent << varName << ".refresh\n";
-    m_output << m_option.indent << "end\n";
+    m_output << m_option.indent << m_option.indent << m_option.indent << m_option.indent << varName << ".refresh\n";
+    m_output << m_option.indent << m_option.indent << m_option.indent << "end\n";
 }
 
 void WriteInitialization::initializeMenu(DomWidget *w, const QString &/*parentWidget*/)
@@ -2390,7 +2381,7 @@ void WriteInitialization::initializeMenu(DomWidget *w, const QString &/*parentWi
 
     const DomAction *action = m_driver->actionByName(menuAction);
     if (action && action->hasAttributeMenu()) {
-        m_output << m_option.indent << menuAction << " = " << menuName << ".menuAction\n";
+        m_output << m_option.indent << m_option.indent << m_option.indent << menuAction << " = " << menuName << ".menuAction\n";
     }
 }
 
@@ -2435,7 +2426,7 @@ void WriteInitialization::acceptConnection(DomConnection *connection)
     if (sender.isEmpty() || receiver.isEmpty())
         return;
 
-    m_output << m_option.indent << "Qt::Object.connect("
+    m_output << m_option.indent << m_option.indent << m_option.indent << "connect("
         << sender
         << ", "
         << "SIGNAL('" << connection->elementSignal() << "')"
