diff --git a/src/plugins/coreplugin/basefilewizard.cpp b/src/plugins/coreplugin/basefilewizard.cpp
index 4b04d72ad72c0541304e4b1c25d72cc03a7809bf..ba40ced4b54236623c28fd624bf37c11605b1183 100644
--- a/src/plugins/coreplugin/basefilewizard.cpp
+++ b/src/plugins/coreplugin/basefilewizard.cpp
@@ -580,7 +580,6 @@ bool BaseFileWizard::postGenerateFiles(const QWizard *w, const GeneratedFiles &l
             return false;
         }
     }
-    em->ensureEditorManagerVisible();
     return true;
 }
 
diff --git a/src/plugins/coreplugin/designmode.cpp b/src/plugins/coreplugin/designmode.cpp
index ecf54a9be674c476f891fbb890ea5a3accf940cb..c4aff16b61c7b5a358553c8e4f7ec03ce9adbbdb 100644
--- a/src/plugins/coreplugin/designmode.cpp
+++ b/src/plugins/coreplugin/designmode.cpp
@@ -127,6 +127,14 @@ QString DesignMode::id() const
     return QLatin1String(Constants::MODE_DESIGN);
 }
 
+QStringList DesignMode::registeredMimeTypes() const
+{
+    QStringList rc;
+    foreach(const DesignEditorInfo *i, m_editors)
+        rc += i->mimeTypes;
+    return rc;
+}
+
 void DesignMode::registerDesignWidget(QWidget *widget, const QStringList &mimeTypes, bool preferDesignMode)
 {
     int index = m_stackWidget->addWidget(widget);
diff --git a/src/plugins/coreplugin/designmode.h b/src/plugins/coreplugin/designmode.h
index c52b264a08fa3279105bf78b94d5936c1ff842a4..4b28b6da13bdeadfe4c3abb28d43e6a066aadfb0 100644
--- a/src/plugins/coreplugin/designmode.h
+++ b/src/plugins/coreplugin/designmode.h
@@ -78,6 +78,9 @@ public:
     void registerDesignWidget(QWidget *widget, const QStringList &mimeTypes,
                               bool preferDesignMode = false);
     void unregisterDesignWidget(QWidget *widget);
+
+    QStringList registeredMimeTypes() const;
+
     // IContext
     QList<int> context() const;
     QWidget *widget();
diff --git a/src/plugins/coreplugin/editormanager/editormanager.cpp b/src/plugins/coreplugin/editormanager/editormanager.cpp
index 11e397bf4bffcef66017cfd74c0feab64e683cac..1f4089f3a13097433652d27096188b5eb4814628 100644
--- a/src/plugins/coreplugin/editormanager/editormanager.cpp
+++ b/src/plugins/coreplugin/editormanager/editormanager.cpp
@@ -928,8 +928,14 @@ Core::IEditor *EditorManager::activateEditor(Core::Internal::EditorView *view, C
 
     if (!(flags & NoActivate)) {
         setCurrentEditor(editor, (flags & IgnoreNavigationHistory));
-        if (!(flags & NoModeSwitch))
-            ensureEditorManagerVisible();
+        if (!(flags & NoModeSwitch)) {
+            const QString preferredMode = editor->preferredMode();
+            if (preferredMode.isEmpty() || preferredMode == Core::Constants::MODE_EDIT) {
+                ensureEditorManagerVisible();
+            } else {
+                ModeManager::instance()->activateMode(preferredMode);
+            }
+        }
         if (isVisible())
             editor->widget()->setFocus();
     }
diff --git a/src/plugins/coreplugin/editormanager/ieditor.cpp b/src/plugins/coreplugin/editormanager/ieditor.cpp
index 6c3ecf904d00c15104f03e58ed3d46c6aef37d60..7ec81c4ae9739dcf420ac7a3abed9d676facbfcb 100644
--- a/src/plugins/coreplugin/editormanager/ieditor.cpp
+++ b/src/plugins/coreplugin/editormanager/ieditor.cpp
@@ -48,6 +48,8 @@
      (so /bold{not} every time the document changes, but /bold{only once}).
   \o If duplication is supported, you need to ensure that all duplicates
         return the same file().
+  \o QString preferredMode() const is the mode the editor manager should activate.
+     Some editors use a special mode (such as Design mode).
   \endlist
 
   \sa Core::EditorFactoryInterface Core::IContext
diff --git a/src/plugins/coreplugin/editormanager/ieditor.h b/src/plugins/coreplugin/editormanager/ieditor.h
index e639f400e0d30435ad652f52ef8507c430828346..58dd9060d8f75805b658f6df5c46df54ba59b394 100644
--- a/src/plugins/coreplugin/editormanager/ieditor.h
+++ b/src/plugins/coreplugin/editormanager/ieditor.h
@@ -65,6 +65,8 @@ public:
 
     virtual QWidget *toolBar() = 0;
 
+    virtual QString preferredMode() const { return QString(); }
+
 signals:
     void changed();
 };
diff --git a/src/plugins/designer/formeditorw.cpp b/src/plugins/designer/formeditorw.cpp
index 657e7b30596c0b6f637f9139f9607aea2533cb93..5f3a39ecc0ca1eee3e74333b67923181074bf72d 100644
--- a/src/plugins/designer/formeditorw.cpp
+++ b/src/plugins/designer/formeditorw.cpp
@@ -715,8 +715,6 @@ void FormEditorW::currentEditorChanged(Core::IEditor *editor)
         m_fwm->setActiveFormWindow(fw->formWindow());
         m_actionGroupEditMode->setVisible(true);
         m_modeActionSeparator->setVisible(true);
-        // Now switch to design mode.
-        m_core->modeManager()->activateMode(QLatin1String(Core::Constants::MODE_DESIGN));
     } else {
         // Deactivate Designer if a non-form is being edited
         m_actionGroupEditMode->setVisible(false);
diff --git a/src/plugins/designer/formwindoweditor.cpp b/src/plugins/designer/formwindoweditor.cpp
index 9fe8e3916d7ec23447381f86fb34435e3a140c50..760c3c491e44fe4437c761f96b17788b54e0a756 100644
--- a/src/plugins/designer/formwindoweditor.cpp
+++ b/src/plugins/designer/formwindoweditor.cpp
@@ -248,8 +248,10 @@ TextEditor::PlainTextEditorEditable *FormWindowEditor::textEditable()
     return &d->m_textEditable;
 }
 
-
-
+QString FormWindowEditor::preferredMode() const
+{
+    return QLatin1String(Core::Constants::MODE_DESIGN);
+}
 
 } // namespace Designer
 
diff --git a/src/plugins/designer/formwindoweditor.h b/src/plugins/designer/formwindoweditor.h
index b99317e9ce9e38a5117072c87e460388304cc32b..d85845e7d2d59bd9239a5b2db3d3df41c966db09 100644
--- a/src/plugins/designer/formwindoweditor.h
+++ b/src/plugins/designer/formwindoweditor.h
@@ -88,6 +88,8 @@ public:
 
     virtual QWidget *toolBar();
 
+    virtual  QString preferredMode() const;
+
     // IContext
     virtual QList<int> context() const;
     virtual QWidget *widget();
diff --git a/src/plugins/qmldesigner/designersettings.cpp b/src/plugins/qmldesigner/designersettings.cpp
index b5eee4e051e07f83cb3867fc83f8982425ab0db5..acfa55cd829af81fd21ce7cc8bf5f71ab1b0c285 100644
--- a/src/plugins/qmldesigner/designersettings.cpp
+++ b/src/plugins/qmldesigner/designersettings.cpp
@@ -28,13 +28,12 @@
 **************************************************************************/
 
 #include "designersettings.h"
+#include "qmldesignerconstants.h"
 
 #include <QtCore/QSettings>
 
 using namespace QmlDesigner;
 
-static const char *qmlGroup = "Qml";
-static const char *qmlDesignerGroup = "Designer";
 static const char *snapToGridKey = "SnapToGrid";
 static const char *showBoundingRectanglesKey = "ShowBoundingRectangles";
 static const char *onlyShowItemsWithContentsKey = "OnlyShowItemsWithContents";
@@ -43,29 +42,34 @@ DesignerSettings::DesignerSettings()
     : snapToGrid(false)
     , showBoundingRectangles(false)
     , onlyShowItemsWithContents(false)
+    , openDesignMode(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)
 {}
 void DesignerSettings::fromSettings(QSettings *settings)
 {
-    settings->beginGroup(QLatin1String(qmlGroup));
-    settings->beginGroup(QLatin1String(qmlDesignerGroup));
+    settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP));
+    settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP));
     snapToGrid = settings->value(QLatin1String(snapToGridKey), false).toBool();
     showBoundingRectangles = settings->value(
             QLatin1String(showBoundingRectanglesKey), false).toBool();
     onlyShowItemsWithContents = settings->value(
             QLatin1String(onlyShowItemsWithContentsKey), false).toBool();
+    openDesignMode = settings->value(
+            QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY),
+            bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT)).toBool();
     settings->endGroup();
     settings->endGroup();
 }
 
 void DesignerSettings::toSettings(QSettings *settings) const
 {
-    settings->beginGroup(QLatin1String(qmlGroup));
-    settings->beginGroup(QLatin1String(qmlDesignerGroup));
+    settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP));
+    settings->beginGroup(QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP));
     settings->setValue(QLatin1String(snapToGridKey), snapToGrid);
     settings->setValue(QLatin1String(showBoundingRectanglesKey),
                        showBoundingRectangles);
     settings->setValue(QLatin1String(onlyShowItemsWithContentsKey),
                        onlyShowItemsWithContents);
+    settings->setValue(QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY), openDesignMode);
     settings->endGroup();
     settings->endGroup();
 }
@@ -73,5 +77,7 @@ void DesignerSettings::toSettings(QSettings *settings) const
 bool DesignerSettings::equals(const DesignerSettings &other) const
 {
     return snapToGrid == other.snapToGrid
-            && showBoundingRectangles == other.showBoundingRectangles;
+            && showBoundingRectangles == other.showBoundingRectangles
+            && onlyShowItemsWithContents == other.onlyShowItemsWithContents
+            && openDesignMode == other.openDesignMode;
 }
diff --git a/src/plugins/qmldesigner/designersettings.h b/src/plugins/qmldesigner/designersettings.h
index 50d88015782a7ee3ef4ea24e416750b7516355b6..af23234a2fceb87fc15df74a609d3634e2699ef8 100644
--- a/src/plugins/qmldesigner/designersettings.h
+++ b/src/plugins/qmldesigner/designersettings.h
@@ -50,6 +50,7 @@ struct DesignerSettings {
     bool snapToGrid;
     bool showBoundingRectangles;
     bool onlyShowItemsWithContents;
+    bool openDesignMode;
 };
 
 inline bool operator==(const DesignerSettings &s1, const DesignerSettings &s2)
diff --git a/src/plugins/qmldesigner/qmldesignerconstants.h b/src/plugins/qmldesigner/qmldesignerconstants.h
index 1e75f5625c9e51e69e3475dab4be37ab35645cd4..13ce485e0278d11c12deabf0bd55e3ba6be8912a 100644
--- a/src/plugins/qmldesigner/qmldesignerconstants.h
+++ b/src/plugins/qmldesigner/qmldesignerconstants.h
@@ -30,8 +30,6 @@
 #ifndef QMLDESIGNERPLUGIN_CONSTANTS_H
 #define QMLDESIGNERPLUGIN_CONSTANTS_H
 
-#include <coreplugin/coreconstants.h>
-
 namespace QmlDesigner {
 namespace Constants {
 
@@ -46,11 +44,16 @@ const char * const SWITCH_TEXT_DESIGN   = "QmlDesigner.SwitchTextDesign";
 
 // mode
 const char * const DESIGN_MODE_NAME     = "Design";
-const int DESIGN_MODE_PRIORITY          = Core::Constants::P_MODE_EDIT - 1;
 
 // Wizard type
 const char * const FORM_MIMETYPE        = "application/x-qmldesigner";
 
+// This setting is also accessed by the QMlJsEditor.
+const char * const QML_SETTINGS_GROUP = "Qml";
+const char * const QML_DESIGNER_SETTINGS_GROUP = "Designer";
+const char * const QML_OPENDESIGNMODE_SETTINGS_KEY = "OpenDesignMode";
+enum { QML_OPENDESIGNMODE_DEFAULT = 1 };
+
 namespace Internal {
     enum { debug = 0 };
 }
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.cpp b/src/plugins/qmldesigner/qmldesignerplugin.cpp
index 07aff5d0e374969e97cd418fb9ec01e7fec7c153..8c639bd57788b97b44203f7ae5b67eb06da63f63 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.cpp
+++ b/src/plugins/qmldesigner/qmldesignerplugin.cpp
@@ -204,7 +204,6 @@ void BauhausPlugin::createDesignModeWidget()
                                             Core::Constants::PASTE, m_context->context());
     command->setDefaultKeySequence(QKeySequence::Paste);
     editMenu->addAction(command, Core::Constants::G_EDIT_COPYPASTE);
-    Core::ModeManager *modeManager = creatorCore->modeManager();
 
     command = actionManager->registerAction(m_mainWidget->selectAllAction(),
                                             Core::Constants::SELECTALL, m_context->context());
@@ -222,9 +221,6 @@ void BauhausPlugin::createDesignModeWidget()
     connect(m_editorManager, SIGNAL(currentEditorChanged(Core::IEditor*)),
             this, SLOT(updateEditor(Core::IEditor*)));
 
-    connect(modeManager, SIGNAL(currentModeChanged(Core::IMode*)),
-            this, SLOT(modeChanged(Core::IMode*)));
-
     connect(m_editorManager, SIGNAL(editorsClosed(QList<Core::IEditor*>)),
             this, SLOT(textEditorsClosed(QList<Core::IEditor*>)));
 
@@ -240,19 +236,6 @@ void BauhausPlugin::updateEditor(Core::IEditor *editor)
     }
 }
 
-void BauhausPlugin::modeChanged(Core::IMode *mode)
-{
-    if (mode == m_designMode) {
-        m_isActive = true;
-        m_mainWidget->showEditor(m_editorManager->currentEditor());
-    } else {
-        if (m_isActive) {
-            m_isActive = false;
-            m_mainWidget->showEditor(0);
-        }
-    }
-}
-
 void BauhausPlugin::textEditorsClosed(QList<Core::IEditor*> editors)
 {
     m_mainWidget->closeEditors(editors);
diff --git a/src/plugins/qmldesigner/qmldesignerplugin.h b/src/plugins/qmldesigner/qmldesignerplugin.h
index e01df161e8f4b6c630736fdcd00db64943b1d8a7..7a170875b35cf90d9d37456847609f71c672ad02 100644
--- a/src/plugins/qmldesigner/qmldesignerplugin.h
+++ b/src/plugins/qmldesigner/qmldesignerplugin.h
@@ -81,7 +81,6 @@ public:
 private slots:
 
     void switchTextDesign();
-    void modeChanged(Core::IMode *mode);
     void textEditorsClosed(QList<Core::IEditor *> editors);
     void updateActions(Core::IEditor* editor);
     void updateEditor(Core::IEditor *editor);
diff --git a/src/plugins/qmldesigner/settingspage.cpp b/src/plugins/qmldesigner/settingspage.cpp
index 8f074dd7acc758f78a6b1ea510f62bf72ea53014..778848e3de09b9f090b7d6eb59d08897c3b5ed10 100644
--- a/src/plugins/qmldesigner/settingspage.cpp
+++ b/src/plugins/qmldesigner/settingspage.cpp
@@ -38,6 +38,8 @@
 using namespace QmlDesigner;
 using namespace QmlDesigner::Internal;
 
+enum EditModeCombo { EditModeDesign, EditModeEdit };
+
 SettingsPageWidget::SettingsPageWidget(QWidget *parent) :
     QWidget(parent)
 {
@@ -51,6 +53,7 @@ DesignerSettings SettingsPageWidget::settings() const
     ds.showBoundingRectangles = m_ui.showBoundingRectanglesCheckbox->isChecked();
     ds.onlyShowItemsWithContents =
             m_ui.onlyShowItemsWithContentsCheckBox->isChecked();
+    ds.openDesignMode = m_ui.editorModeComboBox->currentIndex() == EditModeDesign;
     return ds;
 }
 
@@ -59,6 +62,7 @@ void SettingsPageWidget::setSettings(const DesignerSettings &s)
     m_ui.snapToGridCheckbox->setChecked(s.snapToGrid);
     m_ui.showBoundingRectanglesCheckbox->setChecked(s.showBoundingRectangles);
     m_ui.onlyShowItemsWithContentsCheckBox->setChecked(s.onlyShowItemsWithContents);
+    m_ui.editorModeComboBox->setCurrentIndex(s.openDesignMode ? EditModeDesign : EditModeEdit);
 }
 
 QString SettingsPageWidget::searchKeywords() const
diff --git a/src/plugins/qmldesigner/settingspage.ui b/src/plugins/qmldesigner/settingspage.ui
index 09244658e4d08c4e71715b94c7fb4c45c88b1533..5afaa800563f8f6aca62bc379cb2420cf40f74d8 100644
--- a/src/plugins/qmldesigner/settingspage.ui
+++ b/src/plugins/qmldesigner/settingspage.ui
@@ -19,28 +19,49 @@
      <property name="title">
       <string>GroupBox</string>
      </property>
-     <layout class="QVBoxLayout" name="verticalLayout">
-      <item>
+     <layout class="QFormLayout" name="formLayout">
+      <item row="0" column="0" colspan="2">
        <widget class="QCheckBox" name="snapToGridCheckbox">
         <property name="text">
          <string>&amp;Snap to Grid</string>
         </property>
        </widget>
       </item>
-      <item>
+      <item row="1" column="0" colspan="2">
        <widget class="QCheckBox" name="showBoundingRectanglesCheckbox">
         <property name="text">
          <string>Show Bounding Rectangles</string>
         </property>
        </widget>
       </item>
-      <item>
+      <item row="2" column="0" colspan="2">
        <widget class="QCheckBox" name="onlyShowItemsWithContentsCheckBox">
         <property name="text">
          <string>Only Show Items with Contents</string>
         </property>
        </widget>
       </item>
+      <item row="3" column="0">
+       <widget class="QLabel" name="editorModeLabel">
+        <property name="text">
+         <string>Open editor in:</string>
+        </property>
+       </widget>
+      </item>
+      <item row="3" column="1">
+       <widget class="QComboBox" name="editorModeComboBox">
+        <item>
+         <property name="text">
+          <string>Design mode</string>
+         </property>
+        </item>
+        <item>
+         <property name="text">
+          <string>Edit mode</string>
+         </property>
+        </item>
+       </widget>
+      </item>
      </layout>
     </widget>
    </item>
diff --git a/src/plugins/qmljseditor/qmljseditor.cpp b/src/plugins/qmljseditor/qmljseditor.cpp
index 6bcd17c66c0364dcabb8207bcb3f21df8d2c23ee..0822dd39ebf8fa2ad7232c0a1ed37a8a362a3740 100644
--- a/src/plugins/qmljseditor/qmljseditor.cpp
+++ b/src/plugins/qmljseditor/qmljseditor.cpp
@@ -45,6 +45,9 @@
 
 #include <coreplugin/actionmanager/actionmanager.h>
 #include <coreplugin/icore.h>
+#include <coreplugin/coreconstants.h>
+#include <coreplugin/modemanager.h>
+#include <coreplugin/designmode.h>
 #include <coreplugin/mimedatabase.h>
 #include <coreplugin/uniqueidmanager.h>
 #include <extensionsystem/pluginmanager.h>
@@ -53,7 +56,7 @@
 #include <texteditor/textblockiterator.h>
 #include <texteditor/texteditorconstants.h>
 #include <texteditor/texteditorsettings.h>
-
+#include <qmldesigner/qmldesignerconstants.h>
 #include <utils/changeset.h>
 #include <utils/uncommentselection.h>
 
@@ -574,6 +577,36 @@ QmlJSEditorEditable::QmlJSEditorEditable(QmlJSTextEditor *editor)
     m_context << uidm->uniqueIdentifier(TextEditor::Constants::C_TEXTEDITOR);
 }
 
+// Use preferred mode from Bauhaus settings
+static bool openInDesignMode()
+{
+    static bool bauhausDetected = false;
+    static bool bauhausPresent = false;
+    // Check if Bauhaus is loaded, that is, a Design mode widget is
+    // registered for the QML mime type.
+    if (!bauhausDetected) {
+        if (const Core::IMode *dm = Core::ModeManager::instance()->mode(QLatin1String(Core::Constants::MODE_DESIGN)))
+            if (const Core::DesignMode *designMode = qobject_cast<const Core::DesignMode *>(dm))
+                bauhausPresent = designMode->registeredMimeTypes().contains(QLatin1String(QmlJSEditor::Constants::QML_MIMETYPE));
+        bauhausDetected =  true;
+    }
+    if (!bauhausPresent)
+        return false;
+    // Query the bauhaus setting if it wants to be opened in Design mode.
+    const QString settingsKey = QLatin1String(QmlDesigner::Constants::QML_SETTINGS_GROUP)
+                                + QLatin1Char('/') + QLatin1String(QmlDesigner::Constants::QML_DESIGNER_SETTINGS_GROUP)
+                                + QLatin1Char('/') + QLatin1String(QmlDesigner::Constants::QML_OPENDESIGNMODE_SETTINGS_KEY);
+    const QVariant openDesignMode = Core::ICore::instance()->settings()->value(settingsKey);
+    return openDesignMode.isValid() ? openDesignMode.toBool() : bool(QmlDesigner::Constants::QML_OPENDESIGNMODE_DEFAULT);
+}
+
+QString QmlJSEditorEditable::preferredMode() const
+{
+    if (openInDesignMode())
+        return QLatin1String(Core::Constants::MODE_DESIGN);
+    return QString();
+}
+
 QmlJSTextEditor::QmlJSTextEditor(QWidget *parent) :
     TextEditor::BaseTextEditor(parent),
     m_methodCombo(0),
diff --git a/src/plugins/qmljseditor/qmljseditor.h b/src/plugins/qmljseditor/qmljseditor.h
index 7e361a079d7cb24abc82c7118d3a60d9c1f7c790..46019116d12052af036d510031a12c10e133b078 100644
--- a/src/plugins/qmljseditor/qmljseditor.h
+++ b/src/plugins/qmljseditor/qmljseditor.h
@@ -69,12 +69,12 @@ public:
     QString id() const;
     bool isTemporary() const { return false; }
     virtual bool open(const QString & fileName);
+    virtual QString preferredMode() const;
 
 private:
     QList<int> m_context;
 };
 
-
 struct Declaration
 {
     QString text;