diff --git a/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h b/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h
index 42b0c2fa0785db91f9cc0b0bac838f76e215f960..9d6f0884fd99a278cc56434e48160d725452aef2 100644
--- a/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h
+++ b/share/qtcreator/qml/qmljsdebugger/include/qmljsdebugger_global.h
@@ -43,7 +43,7 @@
 #    define QMLJSDEBUGGER_EXPORT
 #    define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT
 # else
-#    define QMLJSDEBUGGER_EXPORT Q_DECL_IMPORT
+#    define QMLJSDEBUGGER_EXPORT
 #    define QMLJSDEBUGGER_EXTERN Q_DECL_IMPORT
 #endif
 
diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri
index fc303162734a1902c0174945c7b5dbfc6b811c7c..66734cc61a6fe2844e1d61389b7d1bab1f72acf1 100644
--- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri
+++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger-lib.pri
@@ -1,67 +1,6 @@
 # This file is part of Qt Creator
 # It enables debugging of Qt Quick applications
 
-QT += declarative script
+QT += declarative
 INCLUDEPATH += $$PWD/include
-DEPENDPATH += $$PWD $$PWD/include editor $$PWD/qt-private
-
-contains(CONFIG, dll) {
-    DEFINES += BUILD_QMLJSDEBUGGER_LIB
-} else {
-    DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB
-}
-
-!contains(DEFINES, NO_JSDEBUGGER) {
-
-    HEADERS += \
-        include/jsdebuggeragent.h \
-        include/qmljsdebugger_global.h
-
-    SOURCES += \
-        jsdebuggeragent.cpp
-}
-
-!contains(DEFINES, NO_QMLOBSERVER) {
-
-    HEADERS += \
-        include/qdeclarativeviewobserver.h \
-        include/qdeclarativeobserverservice.h \
-        include/qmlobserverconstants.h \
-        editor/abstractliveedittool.h \
-        editor/liveselectiontool.h \
-        editor/livelayeritem.h \
-        editor/livesingleselectionmanipulator.h \
-        editor/liverubberbandselectionmanipulator.h \
-        editor/liveselectionrectangle.h \
-        editor/liveselectionindicator.h \
-        editor/boundingrecthighlighter.h \
-        editor/subcomponenteditortool.h \
-        editor/subcomponentmasklayeritem.h \
-        editor/zoomtool.h \
-        editor/colorpickertool.h \
-        editor/qmltoolbar.h \
-        editor/toolbarcolorbox.h \
-        qdeclarativeviewobserver_p.h
-
-    SOURCES += \
-        qdeclarativeviewobserver.cpp \
-        qdeclarativeobserverservice.cpp \
-        editor/abstractliveedittool.cpp \
-        editor/liveselectiontool.cpp \
-        editor/livelayeritem.cpp \
-        editor/livesingleselectionmanipulator.cpp \
-        editor/liverubberbandselectionmanipulator.cpp \
-        editor/liveselectionrectangle.cpp \
-        editor/liveselectionindicator.cpp \
-        editor/boundingrecthighlighter.cpp \
-        editor/subcomponenteditortool.cpp \
-        editor/subcomponentmasklayeritem.cpp \
-        editor/zoomtool.cpp \
-        editor/colorpickertool.cpp \
-        editor/qmltoolbar.cpp \
-        editor/toolbarcolorbox.cpp
-
-    RESOURCES += editor/editor.qrc
-}
-
-OTHER_FILES += qmljsdebugger.pri
+LIBS += -L$$PWD -lQmlJSDebugger
diff --git a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro
index c46322ef5c276386f770f89024e8ec775da5a670..34d687f9b8aea15f33f0ee25662eea533bf76bd9 100644
--- a/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro
+++ b/share/qtcreator/qml/qmljsdebugger/qmljsdebugger.pro
@@ -2,10 +2,67 @@
 # It enables debugging of Qt Quick applications 
 
 TEMPLATE = lib
-CONFIG+=dll
-TARGET = QmlJSDebugger
+CONFIG += staticlib
+QT += declarative script
+INCLUDEPATH += $$PWD/include
+DEPENDPATH += $$PWD $$PWD/include editor $$PWD/qt-private
+
+DEFINES += BUILD_QMLJSDEBUGGER_STATIC_LIB
 
 unix:QMAKE_CXXFLAGS_DEBUG += -O3
 
-include(../../../../src/qtcreatorlibrary.pri)
-include(qmljsdebugger-lib.pri)
+DESTDIR = $$PWD
+TARGET=qmljsdebugger
+CONFIG(debug, debug|release) {
+   windows:TARGET=qmljsdebuggerd
+}
+
+# JS Debugging
+HEADERS += \
+    include/jsdebuggeragent.h \
+    include/qmljsdebugger_global.h
+
+SOURCES += \
+    jsdebuggeragent.cpp
+
+HEADERS += \
+    include/qdeclarativeviewobserver.h \
+    include/qdeclarativeobserverservice.h \
+    include/qmlobserverconstants.h \
+    editor/abstractliveedittool.h \
+    editor/liveselectiontool.h \
+    editor/livelayeritem.h \
+    editor/livesingleselectionmanipulator.h \
+    editor/liverubberbandselectionmanipulator.h \
+    editor/liveselectionrectangle.h \
+    editor/liveselectionindicator.h \
+    editor/boundingrecthighlighter.h \
+    editor/subcomponenteditortool.h \
+    editor/subcomponentmasklayeritem.h \
+    editor/zoomtool.h \
+    editor/colorpickertool.h \
+    editor/qmltoolbar.h \
+    editor/toolbarcolorbox.h \
+    qdeclarativeviewobserver_p.h
+
+SOURCES += \
+    qdeclarativeviewobserver.cpp \
+    qdeclarativeobserverservice.cpp \
+    editor/abstractliveedittool.cpp \
+    editor/liveselectiontool.cpp \
+    editor/livelayeritem.cpp \
+    editor/livesingleselectionmanipulator.cpp \
+    editor/liverubberbandselectionmanipulator.cpp \
+    editor/liveselectionrectangle.cpp \
+    editor/liveselectionindicator.cpp \
+    editor/boundingrecthighlighter.cpp \
+    editor/subcomponenteditortool.cpp \
+    editor/subcomponentmasklayeritem.cpp \
+    editor/zoomtool.cpp \
+    editor/colorpickertool.cpp \
+    editor/qmltoolbar.cpp \
+    editor/toolbarcolorbox.cpp
+
+RESOURCES += editor/editor.qrc
+
+OTHER_FILES += qmljsdebugger.pri
diff --git a/share/qtcreator/qml/qmlobserver/qmlobserver.pro b/share/qtcreator/qml/qmlobserver/qmlobserver.pro
index cd81702cbb3e18d6c66ca50f5d0dc873e3de4f1f..b442d957967433a63af3088a2ed3754820c4ca6c 100644
--- a/share/qtcreator/qml/qmlobserver/qmlobserver.pro
+++ b/share/qtcreator/qml/qmlobserver/qmlobserver.pro
@@ -2,20 +2,17 @@ TEMPLATE = app
 
 CONFIG += qt uic
 
-### FIXME: only debug plugins are now supported.
-CONFIG -= release
-CONFIG += debug
-
 include(qml.pri)
 
 SOURCES += main.cpp
 
-exists($$PWD/qmljsdebugger/qmljsdebugger-lib.pri) {
-# for building helpers within QT_INSTALL_DATA, we deploy the lib inside the observer directory.
-    include($$PWD/qmljsdebugger/qmljsdebugger-lib.pri)
-} else {
-    include($$PWD/../qmljsdebugger/qmljsdebugger-lib.pri)
+# INCLUDEPATH and library path has to be extended by qmake call
+
+DEBUGLIB=qmljsdebugger
+CONFIG(debug, debug|release) {
+    windows:DEBUGLIB = qmljsdebuggerd
 }
+LIBS+=-l$$DEBUGLIB
 
 #INCLUDEPATH += ../../include/QtDeclarative
 #INCLUDEPATH += ../../src/declarative/util
diff --git a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri
index 246f25e784584887d46551fc3e5f02758ab6ce2a..6704a74c1b17ba0d043c5a26808672154e8cf6d9 100644
--- a/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri
+++ b/share/qtcreator/templates/qtquickapp/qmlapplicationviewer/qmlapplicationviewer.pri
@@ -10,49 +10,9 @@ SOURCES += $$PWD/qmlapplicationviewer.cpp
 HEADERS += $$PWD/qmlapplicationviewer.h
 INCLUDEPATH += $$PWD
 
-defineTest(minQtVersion) {
-    maj = $$1
-    min = $$2
-    patch = $$3
-    isEqual(QT_MAJOR_VERSION, $$maj) {
-        isEqual(QT_MINOR_VERSION, $$min) {
-            isEqual(QT_PATCH_VERSION, $$patch) {
-                return(true)
-            }
-            greaterThan(QT_PATCH_VERSION, $$patch) {
-                return(true)
-            }
-        }
-        greaterThan(QT_MINOR_VERSION, $$min) {
-            return(true)
-        }
-    }
-    return(false)
-}
-
-contains(DEFINES, QMLJSDEBUGGER) {
-    CONFIG(debug, debug|release) {
-        !minQtVersion(4, 7, 1) {
-            warning()
-            warning("Disabling QML debugging:")
-            warning()
-            warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.")
-            warning("This library requires Qt 4.7.1 or newer.")
-            warning()
-            DEFINES -= QMLJSDEBUGGER
-        } else:isEmpty(QMLJSDEBUGGER_PATH) {
-            warning()
-            warning("Disabling QML debugging:")
-            warning()
-            warning("Debugging QML requires the qmljsdebugger library that ships with Qt Creator.")
-            warning("Please specify its location on the qmake command line, eg")
-            warning("  qmake -r QMLJSDEBUGGER_PATH=$CREATORDIR/share/qtcreator/qmljsdebugger")
-            warning()
-            DEFINES -= QMLJSDEBUGGER
-        } else {
-            include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
-        }
-    } else {
-        DEFINES -= QMLJSDEBUGGER
-    }
+# Include JS debugger library if QMLJSDEBUGGER_PATH is set
+!isEmpty(QMLJSDEBUGGER_PATH) {
+    include($$QMLJSDEBUGGER_PATH/qmljsdebugger-lib.pri)
+} else {
+    DEFINES -= QMLJSDEBUGGER
 }
diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp
index 7f14df30133d10af7743388982dd27768646d4b2..ae1e90428031e403e0944f3aca7e923ae47023b8 100644
--- a/src/libs/utils/buildablehelperlibrary.cpp
+++ b/src/libs/utils/buildablehelperlibrary.cpp
@@ -255,7 +255,8 @@ bool BuildableHelperLibrary::buildHelper(const QString &helperName, const QStrin
                                          const QString &directory, const QString &makeCommand,
                                          const QString &qmakeCommand, const QString &mkspec,
                                          const Utils::Environment &env, const QString &targetMode,
-                                         QString *output, QString *errorMessage)
+                                         const QStringList &qmakeArguments, QString *output,
+                                         QString *errorMessage)
 {
     const QChar newline = QLatin1Char('\n');
     // Setup process
@@ -284,13 +285,14 @@ bool BuildableHelperLibrary::buildHelper(const QString &helperName, const QStrin
     output->append(newline);
     output->append(QCoreApplication::translate("ProjectExplorer::BuildableHelperLibrary", "Running %1 ...\n").arg(qmakeCommand));
 
-    QStringList qMakeArgs;
+    QStringList qmakeArgs;
     if (!targetMode.isEmpty())
-        qMakeArgs << targetMode;
+        qmakeArgs << targetMode;
     if (!mkspec.isEmpty())
-        qMakeArgs << QLatin1String("-spec") << mkspec;
-    qMakeArgs << proFilename;
-    if (!runBuildProcess(proc, qmakeCommand, qMakeArgs, 30000, false, output, errorMessage))
+        qmakeArgs << QLatin1String("-spec") << mkspec;
+    qmakeArgs << proFilename;
+    qmakeArgs << qmakeArguments;
+    if (!runBuildProcess(proc, qmakeCommand, qmakeArgs, 30000, false, output, errorMessage))
         return false;
     output->append(newline);
     if (makeFullPath.isEmpty()) {
diff --git a/src/libs/utils/buildablehelperlibrary.h b/src/libs/utils/buildablehelperlibrary.h
index 14a9001e60a15ac6e00258db53cf48a15e67c75e..5753eeccf06d604d99ecfc4fc9c7fe4c5377396a 100644
--- a/src/libs/utils/buildablehelperlibrary.h
+++ b/src/libs/utils/buildablehelperlibrary.h
@@ -70,7 +70,8 @@ public:
                             const QString &directory, const QString &makeCommand,
                             const QString &qmakeCommand, const QString &mkspec,
                             const Utils::Environment &env, const QString &targetMode,
-                            QString *output, QString *errorMessage);
+                            const QStringList &qmakeArguments, QString *output,
+                            QString *errorMessage);
 
     static bool getHelperFileInfoFor(const QStringList &validBinaryFilenames,
                                      const QString &directory, QFileInfo* info);
diff --git a/src/libs/utils/debuggerlanguagechooser.cpp b/src/libs/utils/debuggerlanguagechooser.cpp
index 2f918d095f7d03676e74260bc5a356f3a908499f..5f50a6aad17a14be1ff8af11bc20b430ec0164a2 100644
--- a/src/libs/utils/debuggerlanguagechooser.cpp
+++ b/src/libs/utils/debuggerlanguagechooser.cpp
@@ -58,6 +58,8 @@ DebuggerLanguageChooser::DebuggerLanguageChooser(QWidget *parent) :
 
     m_debugServerPortLabel->setBuddy(m_debugServerPort);
 
+    m_qmlDebuggerInfoLabel = new QLabel(tr("<a href=\"qthelp://com.nokia.qtcreator/doc/creator-qml-debugging.html\">What are the prerequisites?</a>"));
+
     connect(m_useQmlDebugger, SIGNAL(toggled(bool)), m_debugServerPort, SLOT(setEnabled(bool)));
     connect(m_useQmlDebugger, SIGNAL(toggled(bool)), m_debugServerPortLabel, SLOT(setEnabled(bool)));
     connect(m_debugServerPort, SIGNAL(valueChanged(int)), this, SLOT(onDebugServerPortChanged(int)));
@@ -67,6 +69,7 @@ DebuggerLanguageChooser::DebuggerLanguageChooser(QWidget *parent) :
     qmlLayout->addWidget(m_useQmlDebugger);
     qmlLayout->addWidget(m_debugServerPortLabel);
     qmlLayout->addWidget(m_debugServerPort);
+    qmlLayout->addWidget(m_qmlDebuggerInfoLabel);
     qmlLayout->addStretch();
 
     QVBoxLayout *layout = new QVBoxLayout;
diff --git a/src/libs/utils/debuggerlanguagechooser.h b/src/libs/utils/debuggerlanguagechooser.h
index a8976494d1704f780ab86359a77e8ff2913d3fae..86ba37bca3a561c2e180f0f14c4bbe09ee5e977c 100644
--- a/src/libs/utils/debuggerlanguagechooser.h
+++ b/src/libs/utils/debuggerlanguagechooser.h
@@ -73,6 +73,7 @@ private:
     QCheckBox *m_useQmlDebugger;
     QSpinBox *m_debugServerPort;
     QLabel *m_debugServerPortLabel;
+    QLabel *m_qmlDebuggerInfoLabel;
 };
 
 } // namespace Utils
diff --git a/src/plugins/projectexplorer/debugginghelper.cpp b/src/plugins/projectexplorer/debugginghelper.cpp
index 35024087bddbab8786a1d90b508f09fcfa4aa245..35cfed88a6d1cb9e4c32e9705efb2392c9bf5332 100644
--- a/src/plugins/projectexplorer/debugginghelper.cpp
+++ b/src/plugins/projectexplorer/debugginghelper.cpp
@@ -125,9 +125,10 @@ QString DebuggingHelperLibrary::copy(const QString &qtInstallData,
 bool DebuggingHelperLibrary::build(const QString &directory, const QString &makeCommand,
                                       const QString &qmakeCommand, const QString &mkspec,
                                       const Utils::Environment &env, const QString &targetMode,
-                                      QString *output, QString *errorMessage)
+                                      const QStringList &qmakeArguments, QString *output,
+                                      QString *errorMessage)
 {
     return buildHelper(QCoreApplication::translate("ProjectExplorer::DebuggingHelperLibrary",
                                                    "GDB helper"), QLatin1String("gdbmacros.pro"), directory,
-                       makeCommand, qmakeCommand, mkspec, env, targetMode, output, errorMessage);
+                       makeCommand, qmakeCommand, mkspec, env, targetMode, qmakeArguments, output, errorMessage);
 }
diff --git a/src/plugins/projectexplorer/debugginghelper.h b/src/plugins/projectexplorer/debugginghelper.h
index 931c46f3d64250273f69acaae741f02fd7b3a25c..71e9344f7db4ba80055a31ac438160c1fa808b04 100644
--- a/src/plugins/projectexplorer/debugginghelper.h
+++ b/src/plugins/projectexplorer/debugginghelper.h
@@ -54,7 +54,7 @@ public:
     static bool build(const QString &directory, const QString &makeCommand,
                       const QString &qmakeCommand, const QString &mkspec,
                       const Utils::Environment &env, const QString &targetMode,
-                      QString *output, QString *errorMessage);
+                      const QStringList &qmakeArguments, QString *output, QString *errorMessage);
 
     // Copy the source files to a target location and return the chosen target location.
     static QString copy(const QString &qtInstallData, QString *errorMessage);
diff --git a/src/plugins/qt4projectmanager/debugginghelper.ui b/src/plugins/qt4projectmanager/debugginghelper.ui
index 6b16da7b6e572ada5f90ad2ff5d7bbfdd5f78c1e..2b77036a2dd68e0b84d43ba251051c6d2447b0ec 100644
--- a/src/plugins/qt4projectmanager/debugginghelper.ui
+++ b/src/plugins/qt4projectmanager/debugginghelper.ui
@@ -68,7 +68,7 @@
        </property>
       </spacer>
      </item>
-     <item row="2" column="0">
+     <item row="3" column="0">
       <widget class="QLabel" name="qmlObserverLabel">
        <property name="toolTip">
         <string>A modified version of qmlviewer with support for QML/JS debugging.</string>
@@ -78,14 +78,14 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="1">
+     <item row="3" column="1">
       <widget class="QLabel" name="qmlObserverStatus">
        <property name="text">
         <string notr="true">TextLabel</string>
        </property>
       </widget>
      </item>
-     <item row="2" column="2">
+     <item row="3" column="2">
       <spacer name="horizontalSpacer_3">
        <property name="orientation">
         <enum>Qt::Horizontal</enum>
@@ -112,13 +112,47 @@
        </property>
       </widget>
      </item>
-     <item row="2" column="4">
+     <item row="3" column="4">
       <widget class="QPushButton" name="qmlObserverBuildButton">
        <property name="text">
         <string>Build</string>
        </property>
       </widget>
      </item>
+     <item row="2" column="0">
+      <widget class="QLabel" name="qmlDebuggingLibLabel">
+       <property name="text">
+        <string>Qml Debugging Library:</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="1">
+      <widget class="QLabel" name="qmlDebuggingLibStatus">
+       <property name="text">
+        <string>TextLabel</string>
+       </property>
+      </widget>
+     </item>
+     <item row="2" column="2">
+      <spacer name="horizontalSpacer_5">
+       <property name="orientation">
+        <enum>Qt::Horizontal</enum>
+       </property>
+       <property name="sizeHint" stdset="0">
+        <size>
+         <width>40</width>
+         <height>20</height>
+        </size>
+       </property>
+      </spacer>
+     </item>
+     <item row="2" column="4">
+      <widget class="QPushButton" name="qmlDebuggingLibBuildButton">
+       <property name="text">
+        <string>Build</string>
+       </property>
+      </widget>
+     </item>
     </layout>
    </item>
    <item>
diff --git a/src/plugins/qt4projectmanager/debugginghelperbuildtask.cpp b/src/plugins/qt4projectmanager/debugginghelperbuildtask.cpp
index a02c25041c87274e68ada1e726d3cfe544bb7930..fcb99b6421c40236b0a9ad6ee2cc354819f4bf76 100644
--- a/src/plugins/qt4projectmanager/debugginghelperbuildtask.cpp
+++ b/src/plugins/qt4projectmanager/debugginghelperbuildtask.cpp
@@ -34,6 +34,7 @@
 #include "debugginghelperbuildtask.h"
 #include "qmldumptool.h"
 #include "qmlobservertool.h"
+#include "qmldebugginglibrary.h"
 #include <projectexplorer/debugginghelper.h>
 
 #include <QtCore/QCoreApplication>
@@ -97,14 +98,25 @@ DebuggingHelperBuildTask::DebuggingHelperBuildTask(QtVersion *version, Tools too
     m_tools = tools;
 
     // Check the build requirements of the tools
+
     if (m_tools & QmlDump) {
         if (!QmlDumpTool::canBuild(version)) {
             m_tools ^= QmlDump;
         }
     }
+
     if (m_tools & QmlObserver) {
         if (!QmlObserverTool::canBuild(version)) {
             m_tools ^= QmlObserver;
+        } else {
+            m_tools |= QmlDebugging;
+        }
+    }
+
+    if (m_tools & QmlDebugging) {
+        if (!QmlDebuggingLibrary::canBuild(version)) {
+            m_tools ^= QmlDebugging;
+            m_tools &= ~QmlObserver; // remove observer if set
         }
     }
 }
@@ -143,7 +155,7 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu
             return false;
         if (!DebuggingHelperLibrary::build(gdbHelperDirectory, m_makeCommand,
                                            m_qmakeCommand, m_mkspec, m_environment,
-                                           m_target, output, &m_errorMessage))
+                                           m_target, QStringList(), output, &m_errorMessage))
             return false;
     }
     future.setProgressValue(2);
@@ -153,20 +165,37 @@ bool DebuggingHelperBuildTask::buildDebuggingHelper(QFutureInterface<void> &futu
         if (qmlDumpToolDirectory.isEmpty())
             return false;
         if (!QmlDumpTool::build(qmlDumpToolDirectory, m_makeCommand, m_qmakeCommand, m_mkspec,
-                                m_environment, m_target, output, &m_errorMessage))
+                                m_environment, m_target, QStringList(), output, &m_errorMessage))
             return false;
     }
     future.setProgressValue(3);
 
+    QString qmlDebuggingDirectory;
+    if (m_tools & QmlDebugging) {
+        qmlDebuggingDirectory = QmlDebuggingLibrary::copy(m_qtInstallData, &m_errorMessage);
+        if (qmlDebuggingDirectory.isEmpty())
+            return false;
+        if (!QmlDebuggingLibrary::build(qmlDebuggingDirectory, m_makeCommand,
+                                                m_qmakeCommand, m_mkspec, m_environment,
+                                                m_target, QStringList(), output, &m_errorMessage))
+            return false;
+    }
+    future.setProgressValue(4);
+
     if (m_tools & QmlObserver) {
         const QString qmlObserverDirectory = QmlObserverTool::copy(m_qtInstallData,
                                                                    &m_errorMessage);
         if (qmlObserverDirectory.isEmpty())
             return false;
+
+        QStringList qmakeArgs;
+        qmakeArgs << QLatin1String("INCLUDEPATH+=") + qmlDebuggingDirectory + "/include";
+        qmakeArgs << QLatin1String("LIBS+=-L") + qmlDebuggingDirectory;
+
         if (!QmlObserverTool::build(qmlObserverDirectory, m_makeCommand, m_qmakeCommand, m_mkspec,
-                                    m_environment, m_target, output, &m_errorMessage))
+                                    m_environment, m_target, qmakeArgs, output, &m_errorMessage))
             return false;
     }
-    future.setProgressValue(4);
+    future.setProgressValue(5);
     return true;
 }
diff --git a/src/plugins/qt4projectmanager/debugginghelperbuildtask.h b/src/plugins/qt4projectmanager/debugginghelperbuildtask.h
index d38dbb04340078380b9c4bb23d814b865985e3e4..3db7f8ce6dd834d8bd9e1af3e7a60a33ce84f9b8 100644
--- a/src/plugins/qt4projectmanager/debugginghelperbuildtask.h
+++ b/src/plugins/qt4projectmanager/debugginghelperbuildtask.h
@@ -47,9 +47,10 @@ class DebuggingHelperBuildTask : public QObject {
 public:
     enum DebuggingHelper {
         GdbDebugging = 0x01,
-        QmlObserver = 0x02,
-        QmlDump = 0x04,
-        AllTools = GdbDebugging | QmlObserver | QmlDump
+        QmlDebugging = 0x02,
+        QmlObserver = 0x04,
+        QmlDump = 0x08,
+        AllTools = GdbDebugging | QmlDebugging | QmlObserver | QmlDump
     };
     Q_DECLARE_FLAGS(Tools, DebuggingHelper)
 
diff --git a/src/plugins/qt4projectmanager/qmakestep.cpp b/src/plugins/qt4projectmanager/qmakestep.cpp
index 902436cf4b9986697c3da871305a329e121b6ef6..e6afac81834d8aeb691537b84fb08bb73ee0fd10 100644
--- a/src/plugins/qt4projectmanager/qmakestep.cpp
+++ b/src/plugins/qt4projectmanager/qmakestep.cpp
@@ -42,15 +42,19 @@
 #include "qt4projectmanager.h"
 #include "qt4target.h"
 #include "qtversionmanager.h"
+#include "debugginghelperbuildtask.h"
 
 #include <projectexplorer/buildsteplist.h>
 
 #include <coreplugin/icore.h>
+#include <coreplugin/progressmanager/progressmanager.h>
 #include <utils/qtcassert.h>
 #include <utils/qtcprocess.h>
 
 #include <QtCore/QDir>
 #include <QtCore/QFile>
+#include <qtconcurrent/runextensions.h>
+#include <QtCore/QtConcurrentRun>
 
 using namespace Qt4ProjectManager;
 using namespace Qt4ProjectManager::Internal;
@@ -61,18 +65,21 @@ const char * const QMAKE_BS_ID("QtProjectManager.QMakeBuildStep");
 
 const char * const QMAKE_ARGUMENTS_KEY("QtProjectManager.QMakeBuildStep.QMakeArguments");
 const char * const QMAKE_FORCED_KEY("QtProjectManager.QMakeBuildStep.QMakeForced");
+const char * const QMAKE_QMLDEBUGLIB_KEY("QtProjectManager.QMakeBuildStep.LinkQmlDebuggingLibrary");
 }
 
 QMakeStep::QMakeStep(BuildStepList *bsl) :
     AbstractProcessStep(bsl, QLatin1String(QMAKE_BS_ID)),
-    m_forced(false)
+    m_forced(false),
+    m_linkQmlDebuggingLibrary(false)
 {
     ctor();
 }
 
 QMakeStep::QMakeStep(BuildStepList *bsl, const QString &id) :
     AbstractProcessStep(bsl, id),
-    m_forced(false)
+    m_forced(false),
+    m_linkQmlDebuggingLibrary(false)
 {
     ctor();
 }
@@ -80,7 +87,8 @@ QMakeStep::QMakeStep(BuildStepList *bsl, const QString &id) :
 QMakeStep::QMakeStep(BuildStepList *bsl, QMakeStep *bs) :
     AbstractProcessStep(bsl, bs),
     m_forced(bs->m_forced),
-    m_userArgs(bs->m_userArgs)
+    m_userArgs(bs->m_userArgs),
+    m_linkQmlDebuggingLibrary(bs->m_linkQmlDebuggingLibrary)
 {
     ctor();
 }
@@ -166,9 +174,15 @@ QStringList QMakeStep::moreArguments()
                   << QLatin1String("RCC_DIR=rcc");
     }
 
-    // Do not turn debugger path into native path separators: Qmake does not like that!
-    arguments << QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH) + QLatin1Char('=') +
-            Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger");
+    if (m_linkQmlDebuggingLibrary
+            && !bc->qtVersion()->qmlDebuggingHelperLibrary(true).isEmpty()) {
+        // Do not turn debugger path into native path separators: Qmake does not like that!
+        const QString debuggingHelperPath
+                = QFileInfo(bc->qtVersion()->qmlDebuggingHelperLibrary(true)).dir().path();
+
+        arguments << QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)
+                     + QLatin1Char('=') + debuggingHelperPath;
+    }
     return arguments;
 }
 
@@ -313,6 +327,57 @@ void QMakeStep::setUserArguments(const QString &arguments)
     qt4BuildConfiguration()->emitProFileEvaluteNeeded();
 }
 
+bool QMakeStep::isQmlDebuggingLibrarySupported(QString *reason) const
+{
+    if (qt4BuildConfiguration()->qtVersion()->hasQmlDebuggingLibrary())
+        return true;
+
+    int major, minor, patch;
+    if (!qt4BuildConfiguration()->qtVersion()->versionNumbers(&major, &minor, &patch)) {
+        if (reason)
+            *reason = tr("Invalid Qt version.");
+        return false;
+    }
+
+    // only support 4.7.1 onwards
+    bool compatibleQt = false;
+    if (major == 4) {
+        if (minor == 7) {
+            if (patch >= 1)
+                compatibleQt = true;
+        } else if (minor > 7)
+            compatibleQt = true;
+    }
+
+    if (!compatibleQt) {
+        if (reason)
+            *reason = tr("Requires Qt 4.7.1 or newer.");
+        return false;
+    }
+
+    if (reason)
+        *reason = tr("Library not available. <a href='compile'>Compile...</a>.");
+
+    return false;
+}
+
+bool QMakeStep::linkQmlDebuggingLibrary() const
+{
+    return m_linkQmlDebuggingLibrary;
+}
+
+void QMakeStep::setLinkQmlDebuggingLibrary(bool enable)
+{
+    if (m_linkQmlDebuggingLibrary == enable)
+        return;
+    m_linkQmlDebuggingLibrary = enable;
+
+    emit linkQmlDebuggingLibraryChanged();
+
+    qt4BuildConfiguration()->emitQMakeBuildConfigurationChanged();
+    qt4BuildConfiguration()->emitProFileEvaluteNeeded();
+}
+
 QStringList QMakeStep::parserArguments()
 {
     QStringList result;
@@ -342,6 +407,7 @@ QVariantMap QMakeStep::toMap() const
 {
     QVariantMap map(AbstractProcessStep::toMap());
     map.insert(QLatin1String(QMAKE_ARGUMENTS_KEY), m_userArgs);
+    map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary);
     map.insert(QLatin1String(QMAKE_FORCED_KEY), m_forced);
     return map;
 }
@@ -350,6 +416,7 @@ bool QMakeStep::fromMap(const QVariantMap &map)
 {
     m_userArgs = map.value(QLatin1String(QMAKE_ARGUMENTS_KEY)).toString();
     m_forced = map.value(QLatin1String(QMAKE_FORCED_KEY), false).toBool();
+    m_linkQmlDebuggingLibrary = map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool();
     return BuildStep::fromMap(map);
 }
 
@@ -365,8 +432,14 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
             this, SLOT(qmakeArgumentsLineEdited()));
     connect(m_ui.buildConfigurationComboBox, SIGNAL(currentIndexChanged(int)),
             this, SLOT(buildConfigurationSelected()));
+    connect(m_ui.qmlDebuggingLibraryCheckBox, SIGNAL(toggled(bool)),
+            this, SLOT(linkQmlDebuggingLibraryChecked(bool)));
+    connect(m_ui.qmlDebuggingWarningText, SIGNAL(linkActivated(QString)),
+            this, SLOT(buildQmlDebuggingHelper()));
     connect(step, SIGNAL(userArgumentsChanged()),
             this, SLOT(userArgumentsChanged()));
+    connect(step, SIGNAL(linkQmlDebuggingLibraryChanged()),
+            this, SLOT(linkQmlDebuggingLibraryChanged()));
     connect(step->qt4BuildConfiguration(), SIGNAL(qtVersionChanged()),
             this, SLOT(qtVersionChanged()));
     connect(step->qt4BuildConfiguration(), SIGNAL(qmakeBuildConfigurationChanged()),
@@ -376,11 +449,14 @@ QMakeStepConfigWidget::QMakeStepConfigWidget(QMakeStep *step)
 void QMakeStepConfigWidget::init()
 {
     m_ui.qmakeAdditonalArgumentsLineEdit->setText(m_step->userArguments());
+    m_ui.qmlDebuggingLibraryCheckBox->setEnabled(m_step->isQmlDebuggingLibrarySupported());
+    m_ui.qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
 
     qmakeBuildConfigChanged();
 
     updateSummaryLabel();
     updateEffectiveQMakeCall();
+    updateQmlDebuggingWarningsLabel();
 }
 
 QString QMakeStepConfigWidget::summaryText() const
@@ -423,6 +499,18 @@ void QMakeStepConfigWidget::userArgumentsChanged()
     updateEffectiveQMakeCall();
 }
 
+void QMakeStepConfigWidget::linkQmlDebuggingLibraryChanged()
+{
+    if (m_ignoreChange)
+        return;
+    m_ui.qmlDebuggingLibraryCheckBox->setEnabled(m_step->isQmlDebuggingLibrarySupported());
+    m_ui.qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
+
+    updateSummaryLabel();
+    updateEffectiveQMakeCall();
+    updateQmlDebuggingWarningsLabel();
+}
+
 void QMakeStepConfigWidget::qmakeArgumentsLineEdited()
 {
     m_ignoreChange = true;
@@ -459,6 +547,46 @@ void QMakeStepConfigWidget::buildConfigurationSelected()
     updateEffectiveQMakeCall();
 }
 
+void QMakeStepConfigWidget::linkQmlDebuggingLibraryChecked(bool checked)
+{
+    if (m_ignoreChange)
+        return;
+
+    m_ignoreChange = true;
+    m_step->setLinkQmlDebuggingLibrary(checked);
+    m_ignoreChange = false;
+
+    updateSummaryLabel();
+    updateEffectiveQMakeCall();
+    updateQmlDebuggingWarningsLabel();
+}
+
+void QMakeStepConfigWidget::buildQmlDebuggingHelper()
+{
+    QtVersion *version = m_step->qt4BuildConfiguration()->qtVersion();
+    DebuggingHelperBuildTask *buildTask = new DebuggingHelperBuildTask(version,
+                                                                       DebuggingHelperBuildTask::QmlDebugging);
+
+    connect(buildTask, SIGNAL(finished(int,DebuggingHelperBuildTask::Tools,QString)),
+            this, SLOT(debuggingHelperBuildFinished()),
+            Qt::QueuedConnection);
+
+    QFuture<void> task = QtConcurrent::run(&DebuggingHelperBuildTask::run, buildTask);
+    const QString taskName = tr("Building helpers");
+    Core::ICore::instance()->progressManager()->addTask(task, taskName,
+                                                        QLatin1String("Qt4ProjectManager::BuildHelpers"));
+}
+
+void QMakeStepConfigWidget::debuggingHelperBuildFinished()
+{
+    m_step->qt4BuildConfiguration()->qtVersion()->invalidateCache();
+    m_ui.qmlDebuggingLibraryCheckBox->setChecked(m_step->linkQmlDebuggingLibrary());
+    m_ui.qmlDebuggingLibraryCheckBox->setEnabled(m_step->isQmlDebuggingLibrarySupported());
+    updateSummaryLabel();
+    updateEffectiveQMakeCall();
+    updateQmlDebuggingWarningsLabel();
+}
+
 void QMakeStepConfigWidget::updateSummaryLabel()
 {
     Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();
@@ -478,6 +606,23 @@ void QMakeStepConfigWidget::updateSummaryLabel()
 
 }
 
+void QMakeStepConfigWidget::updateQmlDebuggingWarningsLabel()
+{
+    QString reason;
+    m_ui.qmlDebuggingWarningText->clear();
+    if (!m_step->isQmlDebuggingLibrarySupported(&reason)) {
+        m_ui.qmlDebuggingWarningText->setText(reason);
+    }
+
+    if (m_step->linkQmlDebuggingLibrary()) {
+        if (m_step->isQmlDebuggingLibrarySupported()) {
+            m_ui.qmlDebuggingWarningText->setText("Might make your application vulnerable. Only use in a safe environment!");
+        }
+    }
+
+    m_ui.qmlDebuggingWarningIcon->setVisible(!m_ui.qmlDebuggingWarningText->text().isEmpty());
+}
+
 void QMakeStepConfigWidget::updateEffectiveQMakeCall()
 {
     Qt4BuildConfiguration *qt4bc = m_step->qt4BuildConfiguration();
diff --git a/src/plugins/qt4projectmanager/qmakestep.h b/src/plugins/qt4projectmanager/qmakestep.h
index a1e82bbc1d5e323934bc1a0a7594e3828985610e..24869cf0c196ac5ddc9078736100849e32453c1f 100644
--- a/src/plugins/qt4projectmanager/qmakestep.h
+++ b/src/plugins/qt4projectmanager/qmakestep.h
@@ -95,11 +95,15 @@ public:
     QStringList parserArguments();
     QString userArguments();
     void setUserArguments(const QString &arguments);
+    bool linkQmlDebuggingLibrary() const;
+    void setLinkQmlDebuggingLibrary(bool enable);
+    bool isQmlDebuggingLibrarySupported(QString *reason = 0) const;
 
     QVariantMap toMap() const;
 
 signals:
     void userArgumentsChanged();
+    void linkQmlDebuggingLibraryChanged();
 
 protected:
     QMakeStep(ProjectExplorer::BuildStepList *parent, QMakeStep *source);
@@ -117,6 +121,7 @@ private:
     bool m_forced;
     bool m_needToRunQMake; // set in init(), read in run()
     QString m_userArgs;
+    bool m_linkQmlDebuggingLibrary;
     bool m_scriptTemplate;
     QList<ProjectExplorer::Task> m_tasks;
 };
@@ -135,12 +140,20 @@ private slots:
     void qtVersionChanged();
     void qmakeBuildConfigChanged();
     void userArgumentsChanged();
+    void linkQmlDebuggingLibraryChanged();
 
     // slots for dealing with user changes in our UI
     void qmakeArgumentsLineEdited();
     void buildConfigurationSelected();
+    void linkQmlDebuggingLibraryChecked(bool checked);
+
+    // other
+    void buildQmlDebuggingHelper();
+    void debuggingHelperBuildFinished();
+
 private:
     void updateSummaryLabel();
+    void updateQmlDebuggingWarningsLabel();
     void updateEffectiveQMakeCall();
     Ui::QMakeStep m_ui;
     QMakeStep *m_step;
diff --git a/src/plugins/qt4projectmanager/qmakestep.ui b/src/plugins/qt4projectmanager/qmakestep.ui
index cf2214062d622fa154cab1eeb7c71950976b478d..9beeadf36cfac10745db464422ca03e3026adf67 100644
--- a/src/plugins/qt4projectmanager/qmakestep.ui
+++ b/src/plugins/qt4projectmanager/qmakestep.ui
@@ -6,14 +6,11 @@
    <rect>
     <x>0</x>
     <y>0</y>
-    <width>390</width>
-    <height>172</height>
+    <width>440</width>
+    <height>190</height>
    </rect>
   </property>
   <layout class="QFormLayout" name="formLayout">
-   <property name="margin">
-    <number>0</number>
-   </property>
    <item row="0" column="0">
     <widget class="QLabel" name="label_2">
      <property name="text">
@@ -57,6 +54,56 @@
     <widget class="QLineEdit" name="qmakeAdditonalArgumentsLineEdit"/>
    </item>
    <item row="2" column="0">
+    <widget class="QLabel" name="label_3">
+     <property name="text">
+      <string>Link QML debugging library:</string>
+     </property>
+    </widget>
+   </item>
+   <item row="2" column="1">
+    <widget class="QWidget" name="widget" native="true">
+     <layout class="QHBoxLayout" name="horizontalLayout">
+      <property name="margin">
+       <number>0</number>
+      </property>
+      <item>
+       <widget class="QCheckBox" name="qmlDebuggingLibraryCheckBox">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="qmlDebuggingWarningIcon">
+        <property name="pixmap">
+         <pixmap resource="../projectexplorer/projectexplorer.qrc">:/projectexplorer/images/compile_warning.png</pixmap>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <widget class="QLabel" name="qmlDebuggingWarningText">
+        <property name="text">
+         <string/>
+        </property>
+       </widget>
+      </item>
+      <item>
+       <spacer name="horizontalSpacer">
+        <property name="orientation">
+         <enum>Qt::Horizontal</enum>
+        </property>
+        <property name="sizeHint" stdset="0">
+         <size>
+          <width>40</width>
+          <height>20</height>
+         </size>
+        </property>
+       </spacer>
+      </item>
+     </layout>
+    </widget>
+   </item>
+   <item row="3" column="0">
     <widget class="QLabel" name="label">
      <property name="text">
       <string>Effective qmake call:</string>
@@ -66,7 +113,7 @@
      </property>
     </widget>
    </item>
-   <item row="2" column="1">
+   <item row="3" column="1">
     <widget class="QPlainTextEdit" name="qmakeArgumentsEdit">
      <property name="enabled">
       <bool>true</bool>
@@ -84,6 +131,8 @@
    </item>
   </layout>
  </widget>
- <resources/>
+ <resources>
+  <include location="../projectexplorer/projectexplorer.qrc"/>
+ </resources>
  <connections/>
 </ui>
diff --git a/src/plugins/qt4projectmanager/qmldebugginglibrary.cpp b/src/plugins/qt4projectmanager/qmldebugginglibrary.cpp
new file mode 100644
index 0000000000000000000000000000000000000000..354e9904201d1867058b5a62976b0c81961dd8ea
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qmldebugginglibrary.cpp
@@ -0,0 +1,156 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#include "qmldebugginglibrary.h"
+
+#include "qt4project.h"
+#include "qt4projectmanagerconstants.h"
+#include <coreplugin/icore.h>
+#include <utils/qtcassert.h>
+
+#include <projectexplorer/project.h>
+#include <QDesktopServices>
+#include <QCoreApplication>
+#include <QDir>
+#include <QDebug>
+
+namespace Qt4ProjectManager {
+
+
+QString QmlDebuggingLibrary::libraryByInstallData(const QString &qtInstallData, bool debugBuild)
+{
+    if (!Core::ICore::instance())
+        return QString();
+
+    const QString mainFilename = Core::ICore::instance()->resourcePath()
+            + QLatin1String("/qml/qmljsdebugger/qmljsdebugger.pro");
+    const QStringList directories = installDirectories(qtInstallData);
+
+    QStringList binFilenames;
+    if (debugBuild) {
+        binFilenames << QLatin1String("qmljsdebuggerd.lib");
+        binFilenames << QLatin1String("libqmljsdebuggerd.a"); // mingw
+    } else {
+        binFilenames << QLatin1String("qmljsdebugger.lib");
+    }
+    binFilenames << QLatin1String("libqmljsdebugger.a");
+
+    return byInstallDataHelper(mainFilename, directories, binFilenames);
+}
+
+bool QmlDebuggingLibrary::canBuild(const QtVersion *qtVersion)
+{
+    return checkMinimumQtVersion(qtVersion->qtVersionString(), 4, 7, 1);
+}
+
+bool  QmlDebuggingLibrary::build(const QString &directory, const QString &makeCommand,
+                             const QString &qmakeCommand, const QString &mkspec,
+                             const Utils::Environment &env, const QString &targetMode,
+                             const QStringList &qmakeArguments, QString *output,  QString *errorMessage)
+{
+    return buildHelper(QCoreApplication::translate("Qt4ProjectManager::QmlDebuggingLibrary", "Qml Debugging"),
+                       QLatin1String("qmljsdebugger.pro"),
+                       directory, makeCommand, qmakeCommand, mkspec, env, targetMode,
+                       qmakeArguments, output, errorMessage);
+}
+
+static inline bool mkpath(const QString &targetDirectory, QString *errorMessage)
+{
+    if (!QDir().mkpath(targetDirectory)) {
+        *errorMessage = QCoreApplication::translate("Qt4ProjectManager::QmlDebuggingLibrary", "The target directory %1 could not be created.").arg(targetDirectory);
+        return false;
+    }
+    return true;
+}
+
+QString QmlDebuggingLibrary::copy(const QString &qtInstallData, QString *errorMessage)
+{
+    const QStringList directories = QmlDebuggingLibrary::installDirectories(qtInstallData);
+
+    QString sourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger/");
+
+    QStringList qmljsDebuggerFiles = recursiveFileList(QDir(sourcePath));
+
+    // Try to find a writeable directory.
+    foreach (const QString &directory, directories) {
+        if (!mkpath(directory, errorMessage)) {
+            continue;
+        } else {
+            errorMessage->clear();
+        }
+
+        if (copyFiles(sourcePath, qmljsDebuggerFiles,
+                      directory, errorMessage))
+        {
+            errorMessage->clear();
+            return directory;
+        }
+    }
+    *errorMessage = QCoreApplication::translate("Qt4ProjectManager::QmlDebuggingLibrary",
+                                                "Qml Debugging library could not be built in any of the directories:\n- %1\n\nReason: %2")
+                    .arg(directories.join(QLatin1String("\n- ")), *errorMessage);
+    return QString();
+}
+
+QStringList QmlDebuggingLibrary::recursiveFileList(const QDir &dir, const QString &prefix)
+{
+    QStringList files;
+
+    QString _prefix = prefix;
+    if (!_prefix.isEmpty() && !_prefix.endsWith('/')) {
+        _prefix = _prefix + '/';
+    }
+    foreach (const QString &fileName, dir.entryList(QDir::Files)) {
+        files << _prefix + fileName;
+    }
+
+    foreach (const QString &subDir, dir.entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
+        files += recursiveFileList(QDir(dir.absoluteFilePath(subDir)), _prefix + subDir);
+    }
+    return files;
+}
+
+QStringList QmlDebuggingLibrary::installDirectories(const QString &qtInstallData)
+{
+    const QChar slash = QLatin1Char('/');
+    const uint hash = qHash(qtInstallData);
+    QStringList directories;
+    directories
+            << (qtInstallData + QLatin1String("/qtc-qmldbg/"))
+            << QDir::cleanPath((QCoreApplication::applicationDirPath() + QLatin1String("/../qtc-qmldbg/") + QString::number(hash))) + slash
+            << (QDesktopServices::storageLocation(QDesktopServices::DataLocation) + QLatin1String("/qtc-qmldbg/") + QString::number(hash)) + slash;
+    return directories;
+}
+
+
+} // namespace
diff --git a/src/plugins/qt4projectmanager/qmldebugginglibrary.h b/src/plugins/qt4projectmanager/qmldebugginglibrary.h
new file mode 100644
index 0000000000000000000000000000000000000000..21db8f0a911356f32cfd041b394a6f1194c8836d
--- /dev/null
+++ b/src/plugins/qt4projectmanager/qmldebugginglibrary.h
@@ -0,0 +1,74 @@
+/**************************************************************************
+**
+** This file is part of Qt Creator
+**
+** Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
+**
+** Contact: Nokia Corporation (qt-info@nokia.com)
+**
+** No Commercial Usage
+**
+** This file contains pre-release code and may not be distributed.
+** You may use this file in accordance with the terms and conditions
+** contained in the Technology Preview License Agreement accompanying
+** this package.
+**
+** GNU Lesser General Public License Usage
+**
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 2.1 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL included in the
+** packaging of this file.  Please review the following information to
+** ensure the GNU Lesser General Public License version 2.1 requirements
+** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
+**
+** In addition, as a special exception, Nokia gives you certain additional
+** rights.  These rights are described in the Nokia Qt LGPL Exception
+** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
+**
+** If you have questions regarding the use of this file, please contact
+** Nokia at qt-info@nokia.com.
+**
+**************************************************************************/
+
+#ifndef QMLDEBUGGINGLIBRARY_H
+#define QMLDEBUGGINGLIBRARY_H
+
+#include <utils/buildablehelperlibrary.h>
+#include "qt4projectmanager_global.h"
+
+QT_FORWARD_DECLARE_CLASS(QDir)
+
+namespace Utils {
+    class Environment;
+}
+
+namespace ProjectExplorer {
+    class Project;
+}
+
+namespace Qt4ProjectManager {
+
+class QtVersion;
+
+class QmlDebuggingLibrary : public Utils::BuildableHelperLibrary
+{
+public:
+    static QString libraryByInstallData(const QString &qtInstallData, bool debugBuild);
+
+    static bool canBuild(const QtVersion *qtVersion);
+    static bool build(const QString &directory, const QString &makeCommand,
+                       const QString &qmakeCommand, const QString &mkspec,
+                       const Utils::Environment &env, const QString &targetMode,
+                       const QStringList &qmakeArguments, QString *output,  QString *errorMessage);
+    static QString copy(const QString &qtInstallData, QString *errorMessage);
+
+private:
+    static QStringList recursiveFileList(const QDir &dir, const QString &prefix = QString());
+    static QStringList installDirectories(const QString &qtInstallData);
+
+};
+
+} // namespace
+
+#endif // QMLDEBUGGINGLIBRARY_H
diff --git a/src/plugins/qt4projectmanager/qmldumptool.cpp b/src/plugins/qt4projectmanager/qmldumptool.cpp
index 6350313aa671f6194fff5c5f875f501401dfab06..47b0d966859940c61ade44ee0b922f4d9dab603f 100644
--- a/src/plugins/qt4projectmanager/qmldumptool.cpp
+++ b/src/plugins/qt4projectmanager/qmldumptool.cpp
@@ -256,11 +256,11 @@ QStringList QmlDumpTool::locationsByInstallData(const QString &qtInstallData, bo
 bool QmlDumpTool::build(const QString &directory, const QString &makeCommand,
                         const QString &qmakeCommand, const QString &mkspec,
                         const Utils::Environment &env, const QString &targetMode,
-                        QString *output,  QString *errorMessage)
+                        const QStringList &qmakeArguments, QString *output, QString *errorMessage)
 {
     return buildHelper(QCoreApplication::translate("Qt4ProjectManager::QmlDumpTool", "qmldump"), QLatin1String("qmldump.pro"),
                        directory, makeCommand, qmakeCommand, mkspec, env, targetMode,
-                       output, errorMessage);
+                       qmakeArguments, output, errorMessage);
 }
 
 QString QmlDumpTool::copy(const QString &qtInstallData, QString *errorMessage)
diff --git a/src/plugins/qt4projectmanager/qmldumptool.h b/src/plugins/qt4projectmanager/qmldumptool.h
index 132b205868f739abfe02f06696521c917f86d864..f02b03d1c6f3fa0628fcc6b2cce393eb5f105ce2 100644
--- a/src/plugins/qt4projectmanager/qmldumptool.h
+++ b/src/plugins/qt4projectmanager/qmldumptool.h
@@ -60,7 +60,7 @@ public:
     static bool build(const QString &directory, const QString &makeCommand,
                       const QString &qmakeCommand, const QString &mkspec,
                       const Utils::Environment &env, const QString &targetMode,
-                      QString *output,  QString *errorMessage);
+                      const QStringList &qmakeArguments, QString *output,  QString *errorMessage);
 
     // Copy the source files to a target location and return the chosen target location.
     static QString copy(const QString &qtInstallData, QString *errorMessage);
diff --git a/src/plugins/qt4projectmanager/qmlobservertool.cpp b/src/plugins/qt4projectmanager/qmlobservertool.cpp
index c15df93c3cf00c123dae000d42953dcc68f06973..cfd888e8f3264c1b581851a23d4bae1022bcd2fa 100644
--- a/src/plugins/qt4projectmanager/qmlobservertool.cpp
+++ b/src/plugins/qt4projectmanager/qmlobservertool.cpp
@@ -107,12 +107,13 @@ QStringList QmlObserverTool::locationsByInstallData(const QString &qtInstallData
 bool  QmlObserverTool::build(const QString &directory, const QString &makeCommand,
                              const QString &qmakeCommand, const QString &mkspec,
                              const Utils::Environment &env, const QString &targetMode,
-                             QString *output,  QString *errorMessage)
+                             const QStringList &qmakeArguments, QString *output,
+                             QString *errorMessage)
 {
     return buildHelper(QCoreApplication::translate("Qt4ProjectManager::QmlObserverTool", "QMLObserver"),
                        QLatin1String("qmlobserver.pro"),
                        directory, makeCommand, qmakeCommand, mkspec, env, targetMode,
-                       output, errorMessage);
+                       qmakeArguments, output, errorMessage);
 }
 
 static inline bool mkpath(const QString &targetDirectory, QString *errorMessage)
@@ -129,10 +130,8 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag
     const QStringList directories = QmlObserverTool::installDirectories(qtInstallData);
 
     QString sourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmlobserver/");
-    QString libSourcePath = Core::ICore::instance()->resourcePath() + QLatin1String("/qml/qmljsdebugger/");
 
     QStringList observerFiles = recursiveFileList(QDir(sourcePath));
-    QStringList qmljsDebuggerFiles = recursiveFileList(QDir(libSourcePath));
 
     // Try to find a writeable directory.
     foreach(const QString &directory, directories) {
@@ -142,10 +141,7 @@ QString QmlObserverTool::copy(const QString &qtInstallData, QString *errorMessag
             errorMessage->clear();
         }
 
-        if (copyFiles(sourcePath, observerFiles, directory, errorMessage)
-                && copyFiles(libSourcePath, qmljsDebuggerFiles,
-                             directory + QLatin1String("/qmljsdebugger/"), errorMessage))
-        {
+        if (copyFiles(sourcePath, observerFiles, directory, errorMessage)) {
             errorMessage->clear();
             return directory;
         }
diff --git a/src/plugins/qt4projectmanager/qmlobservertool.h b/src/plugins/qt4projectmanager/qmlobservertool.h
index 0b26869c75e7f9f43e411a31d60eb09f39f595dd..865c8ef42d2045b3255fbaa04c1f399a6f35ac1c 100644
--- a/src/plugins/qt4projectmanager/qmlobservertool.h
+++ b/src/plugins/qt4projectmanager/qmlobservertool.h
@@ -63,7 +63,7 @@ public:
     static bool build(const QString &directory, const QString &makeCommand,
                        const QString &qmakeCommand, const QString &mkspec,
                        const Utils::Environment &env, const QString &targetMode,
-                       QString *output,  QString *errorMessage);
+                       const QStringList &qmakeArguments, QString *output,  QString *errorMessage);
 
     // Copy the source files to a target location and return the chosen target location.
     static QString copy(const QString &qtInstallData, QString *errorMessage);
diff --git a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
index ecae28a0911eda565b0dd3c355a1e428843559d8..0c9f05d8926a20ac78818cf29391f7a154d7f793 100644
--- a/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt-desktop/qt4runconfiguration.cpp
@@ -42,6 +42,7 @@
 #include "qt4projectmanagerconstants.h"
 #include "qtoutputformatter.h"
 #include "qt4desktoptarget.h"
+#include "qmakestep.h"
 
 #include <coreplugin/coreconstants.h>
 #include <coreplugin/icore.h>
diff --git a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
index 454bcff03556493ef2bd876a56b2edfaea58c966..b64a83cb4f7490c3afa7ae5f0ea16a41c2a632a8 100644
--- a/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
+++ b/src/plugins/qt4projectmanager/qt4buildconfiguration.cpp
@@ -563,7 +563,7 @@ bool Qt4BuildConfiguration::compareToImportFrom(const QString &makefile)
 void Qt4BuildConfiguration::removeQMLInspectorFromArguments(QString *args)
 {
     for (Utils::QtcProcess::ArgIterator ait(args); ait.next(); )
-        if (ait.value().startsWith(QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)))
+        if (ait.value().contains(QLatin1String(Constants::QMAKEVAR_QMLJSDEBUGGER_PATH)))
             ait.deleteArg();
 }
 
diff --git a/src/plugins/qt4projectmanager/qt4projectmanager.pro b/src/plugins/qt4projectmanager/qt4projectmanager.pro
index 55293315306664ca96baa8594e698c9b04087834..206020966a293ea5761ae4b1722b1e68ec0b7fa7 100644
--- a/src/plugins/qt4projectmanager/qt4projectmanager.pro
+++ b/src/plugins/qt4projectmanager/qt4projectmanager.pro
@@ -68,6 +68,7 @@ HEADERS += \
     qt4projectmanager_global.h \
     qmldumptool.h \
     qmlobservertool.h \
+    qmldebugginglibrary.h \
     profilecompletion.h \
     profilekeywords.h \
     debugginghelperbuildtask.h
@@ -132,6 +133,7 @@ SOURCES += qt4projectmanagerplugin.cpp \
     findqt4profiles.cpp \
     qmldumptool.cpp \
     qmlobservertool.cpp \
+    qmldebugginglibrary.cpp \
     profilecompletion.cpp \
     profilekeywords.cpp \
     debugginghelperbuildtask.cpp
diff --git a/src/plugins/qt4projectmanager/qtoptionspage.cpp b/src/plugins/qt4projectmanager/qtoptionspage.cpp
index b16cf93717af8d3c0eba003c3ad04da1d82d6e59..92fec7ce5f80d68efa1083304eed6fdd88b58c18 100644
--- a/src/plugins/qt4projectmanager/qtoptionspage.cpp
+++ b/src/plugins/qt4projectmanager/qtoptionspage.cpp
@@ -41,6 +41,7 @@
 #include "qtversionmanager.h"
 #include "qmldumptool.h"
 #include "qmlobservertool.h"
+#include "qmldebugginglibrary.h"
 #include "debugginghelperbuildtask.h"
 
 #include <projectexplorer/debugginghelper.h>
@@ -232,6 +233,8 @@ QtOptionsPageWidget::QtOptionsPageWidget(QWidget *parent, QList<QtVersion *> ver
             this, SLOT(buildGdbHelper()));
     connect(m_debuggingHelperUi->qmlDumpBuildButton, SIGNAL(clicked()),
             this, SLOT(buildQmlDump()));
+    connect(m_debuggingHelperUi->qmlDebuggingLibBuildButton, SIGNAL(clicked()),
+            this, SLOT(buildQmlDebuggingLibrary()));
     connect(m_debuggingHelperUi->qmlObserverBuildButton, SIGNAL(clicked()),
             this, SLOT(buildQmlObserver()));
 
@@ -309,6 +312,8 @@ void QtOptionsPageWidget::debuggingHelperBuildFinished(int qtVersionId, Debuggin
     bool success = true;
     if (tools & DebuggingHelperBuildTask::GdbDebugging)
         success &= qtVersion->hasDebuggingHelper();
+    if (tools & DebuggingHelperBuildTask::QmlDebugging)
+        success &= qtVersion->hasQmlDebuggingLibrary();
     if (tools & DebuggingHelperBuildTask::QmlDump)
         success &= qtVersion->hasQmlDump();
     if (tools & DebuggingHelperBuildTask::QmlObserver)
@@ -363,9 +368,17 @@ void QtOptionsPageWidget::buildQmlDump()
     buildDebuggingHelper(DebuggingHelperBuildTask::QmlDump);
 }
 
+void QtOptionsPageWidget::buildQmlDebuggingLibrary()
+{
+    buildDebuggingHelper(DebuggingHelperBuildTask::QmlDebugging);
+}
+
 void QtOptionsPageWidget::buildQmlObserver()
 {
-    buildDebuggingHelper(DebuggingHelperBuildTask::QmlObserver);
+    DebuggingHelperBuildTask::Tools qmlDbgTools =
+            DebuggingHelperBuildTask::QmlObserver
+            | DebuggingHelperBuildTask::QmlDebugging;
+    buildDebuggingHelper(qmlDbgTools);
 }
 
 // Non-modal dialog
@@ -445,9 +458,13 @@ void QtOptionsPageWidget::removeQtDir()
 }
 
 // Format html table tooltip about helpers
-static inline QString msgHtmlHelperToolTip(const QString &gdbHelperPath, const QString &qmlDumpPath, const QString &qmlObserverPath)
+static inline QString msgHtmlHelperToolTip(const QString &gdbHelperPath,
+                                           const QString &qmlJsDebugLibPath,
+                                           const QString &qmlDumpPath,
+                                           const QString &qmlObserverPath)
 {
     QFileInfo gdbHelperFI(gdbHelperPath);
+    QFileInfo qmlJsDebugLibFi(qmlJsDebugLibPath);
     QFileInfo qmlDumpFI(qmlDumpPath);
     QFileInfo qmlObserverFI(qmlObserverPath);
 
@@ -459,19 +476,26 @@ static inline QString msgHtmlHelperToolTip(const QString &gdbHelperPath, const Q
                                    "<tr><td>File:</td><td><pre>%1</pre></td></tr>"
                                    "<tr><td>Last&nbsp;modified:</td><td>%2</td></tr>"
                                    "<tr><td>Size:</td><td>%3 Bytes</td></tr>"
-                                   "<tr><td colspan=\"2\"><b>QML type dumper</b></td></tr>"
+                                   "<tr><td colspan=\"2\"><b>QML debugging library</b></td></tr>"
                                    "<tr><td>File:</td><td><pre>%4</pre></td></tr>"
                                    "<tr><td>Last&nbsp;modified:</td><td>%5</td></tr>"
                                    "<tr><td>Size:</td><td>%6 Bytes</td></tr>"
-                                   "<tr><td colspan=\"2\"><b>QML observer</b></td></tr>"
+                                   "<tr><td colspan=\"2\"><b>QML type dumper</b></td></tr>"
                                    "<tr><td>File:</td><td><pre>%7</pre></td></tr>"
                                    "<tr><td>Last&nbsp;modified:</td><td>%8</td></tr>"
                                    "<tr><td>Size:</td><td>%9 Bytes</td></tr>"
+                                   "<tr><td colspan=\"2\"><b>QML observer</b></td></tr>"
+                                   "<tr><td>File:</td><td><pre>%10</pre></td></tr>"
+                                   "<tr><td>Last&nbsp;modified:</td><td>%11</td></tr>"
+                                   "<tr><td>Size:</td><td>%12 Bytes</td></tr>"
                                    "</table></body></html>"
                                    ).
                       arg(gdbHelperPath.isEmpty() ? notFound : QDir::toNativeSeparators(gdbHelperFI.absoluteFilePath())).
                       arg(gdbHelperFI.lastModified().toString(Qt::SystemLocaleLongDate)).
                       arg(gdbHelperFI.size()).
+                      arg(qmlJsDebugLibPath.isEmpty() ? notFound : QDir::toNativeSeparators(qmlJsDebugLibFi.absoluteFilePath())).
+                      arg(qmlJsDebugLibFi.lastModified().toString(Qt::SystemLocaleLongDate)).
+                      arg(qmlJsDebugLibFi.size()).
                       arg(qmlDumpPath.isEmpty() ? notFound : QDir::toNativeSeparators(qmlDumpFI.absoluteFilePath())).
                       arg(qmlDumpFI.lastModified().toString(Qt::SystemLocaleLongDate)).
                       arg(qmlDumpFI.size()).
@@ -489,14 +513,17 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
         m_ui->debuggingHelperWidget->setVisible(false);
     } else {
         bool canBuildQmlDumper = QmlDumpTool::canBuild(version);
+        bool canBuildQmlDebuggingLib = QmlDebuggingLibrary::canBuild(version);
         bool canBuildQmlObserver = QmlObserverTool::canBuild(version);
 
         bool hasGdbHelper = !version->debuggingHelperLibrary().isEmpty();
         bool hasQmlDumper = version->hasQmlDump();
+        bool hasQmlDebuggingLib = version->hasQmlDebuggingLibrary();
         bool hasQmlObserver = !version->qmlObserverTool().isEmpty();
 
         bool isBuildingGdbHelper = false;
         bool isBuildingQmlDumper = false;
+        bool isBuildingQmlDebuggingLib = false;
         bool isBuildingQmlObserver = false;
 
         if (currentItem) {
@@ -504,6 +531,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
                     = currentItem->data(0, BuildRunningRole).value<DebuggingHelperBuildTask::Tools>();
             isBuildingGdbHelper = buildingTools & DebuggingHelperBuildTask::GdbDebugging;
             isBuildingQmlDumper = buildingTools & DebuggingHelperBuildTask::QmlDump;
+            isBuildingQmlDebuggingLib = buildingTools & DebuggingHelperBuildTask::QmlDebugging;
             isBuildingQmlObserver = buildingTools & DebuggingHelperBuildTask::QmlObserver;
         }
 
@@ -513,6 +541,8 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
             helperNames << m_debuggingHelperUi->gdbHelperLabel->text().remove(':');
         if (hasQmlDumper)
             helperNames << m_debuggingHelperUi->qmlDumpLabel->text().remove(':');
+        if (hasQmlDebuggingLib)
+            helperNames << m_debuggingHelperUi->qmlDebuggingLibLabel->text().remove(':');
         if (hasQmlObserver)
             helperNames << m_debuggingHelperUi->qmlObserverLabel->text().remove(':');
 
@@ -526,7 +556,6 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
 
         m_ui->debuggingHelperWidget->setSummaryText(status);
 
-        // Set detailed labels
         QString gdbHelperText;
         Qt::TextInteractionFlags gdbHelperTextFlags = Qt::NoTextInteraction;
         if (hasGdbHelper) {
@@ -545,7 +574,8 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
             qmlDumpStatusText = QDir::toNativeSeparators(version->qmlDumpTool(false));
             const QString debugQmlDumpPath = QDir::toNativeSeparators(version->qmlDumpTool(true));
             if (qmlDumpStatusText != debugQmlDumpPath) {
-                if (!qmlDumpStatusText.isEmpty())
+                if (!qmlDumpStatusText.isEmpty()
+                        && !debugQmlDumpPath.isEmpty())
                     qmlDumpStatusText += QLatin1String("\n");
                 qmlDumpStatusText += debugQmlDumpPath;
             }
@@ -561,6 +591,35 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
         m_debuggingHelperUi->qmlDumpStatus->setTextInteractionFlags(qmlDumpStatusTextFlags);
         m_debuggingHelperUi->qmlDumpBuildButton->setEnabled(canBuildQmlDumper & !isBuildingQmlDumper);
 
+        QString qmlDebuggingLibStatusText;
+        Qt::TextInteractionFlags qmlDebuggingLibStatusTextFlags = Qt::NoTextInteraction;
+        if (hasQmlDebuggingLib) {
+            qmlDebuggingLibStatusText = QDir::toNativeSeparators(
+                        version->qmlDebuggingHelperLibrary(false));
+            const QString debugPath = QDir::toNativeSeparators(
+                        version->qmlDebuggingHelperLibrary(true));
+
+            if (qmlDebuggingLibStatusText != debugPath) {
+                if (!qmlDebuggingLibStatusText.isEmpty()
+                        && !debugPath.isEmpty()) {
+                    qmlDebuggingLibStatusText += QLatin1String("\n");
+                }
+                qmlDebuggingLibStatusText += debugPath;
+            }
+            qmlDebuggingLibStatusTextFlags = Qt::TextSelectableByMouse;
+        }  else {
+            if (canBuildQmlDebuggingLib) {
+                qmlDebuggingLibStatusText = tr("<i>Not yet built.</i>");
+            } else {
+                qmlDebuggingLibStatusText = tr("<i>Cannot be compiled.</i>");
+            }
+        }
+        m_debuggingHelperUi->qmlDebuggingLibStatus->setText(qmlDebuggingLibStatusText);
+        m_debuggingHelperUi->qmlDebuggingLibStatus->setTextInteractionFlags(qmlDebuggingLibStatusTextFlags);
+        m_debuggingHelperUi->qmlDebuggingLibBuildButton->setEnabled(canBuildQmlDebuggingLib
+                                                                    && !isBuildingQmlDebuggingLib);
+
+
         QString qmlObserverStatusText;
         Qt::TextInteractionFlags qmlObserverStatusTextFlags = Qt::NoTextInteraction;
         if (hasQmlObserver) {
@@ -583,6 +642,7 @@ void QtOptionsPageWidget::updateDebuggingHelperUi()
 
         m_debuggingHelperUi->rebuildButton->setEnabled(!isBuildingGdbHelper
                                                        && !isBuildingQmlDumper
+                                                       && !isBuildingQmlDebuggingLib
                                                        && !isBuildingQmlObserver);
 
         m_ui->debuggingHelperWidget->setVisible(true);
diff --git a/src/plugins/qt4projectmanager/qtoptionspage.h b/src/plugins/qt4projectmanager/qtoptionspage.h
index 95880e291ded19eee6e6e285202bd4c2059a8cb7..b87ee99db070041200b8ea2b04bc70889c60e517 100644
--- a/src/plugins/qt4projectmanager/qtoptionspage.h
+++ b/src/plugins/qt4projectmanager/qtoptionspage.h
@@ -112,6 +112,7 @@ private slots:
                               = DebuggingHelperBuildTask::AllTools);
     void buildGdbHelper();
     void buildQmlDump();
+    void buildQmlDebuggingLibrary();
     void buildQmlObserver();
     void slotShowDebuggingBuildLog();
     void debuggingHelperBuildFinished(int qtVersionId, DebuggingHelperBuildTask::Tools tools, const QString &output);
diff --git a/src/plugins/qt4projectmanager/qtversionmanager.cpp b/src/plugins/qt4projectmanager/qtversionmanager.cpp
index f5675d6356a0765c2dfef63081ff58eb14414707..9543c89dac4eeeac4c005dfb19bec65d02dc3a5b 100644
--- a/src/plugins/qt4projectmanager/qtversionmanager.cpp
+++ b/src/plugins/qt4projectmanager/qtversionmanager.cpp
@@ -46,6 +46,8 @@
 
 #include "qmlobservertool.h"
 #include "qmldumptool.h"
+#include "qmldebugginglibrary.h"
+
 #include <projectexplorer/debugginghelper.h>
 #include <projectexplorer/gnumakeparser.h>
 #include <projectexplorer/projectexplorer.h>
@@ -547,6 +549,7 @@ QtVersion::QtVersion(const QString &name, const QString &qmakeCommand, int id,
     m_autodetectionSource(autodetectionSource),
     m_hasDebuggingHelper(false),
     m_hasQmlDump(false),
+    m_hasQmlDebuggingLibrary(false),
     m_hasQmlObserver(false),
     m_toolChainUpToDate(false),
     m_versionInfoUpToDate(false),
@@ -572,6 +575,7 @@ QtVersion::QtVersion(const QString &name, const QString &qmakeCommand,
     m_autodetectionSource(autodetectionSource),
     m_hasDebuggingHelper(false),
     m_hasQmlDump(false),
+    m_hasQmlDebuggingLibrary(false),
     m_hasQmlObserver(false),
     m_toolChainUpToDate(false),
     m_versionInfoUpToDate(false),
@@ -593,6 +597,7 @@ QtVersion::QtVersion(const QString &qmakeCommand, bool isAutodetected, const QSt
     m_autodetectionSource(autodetectionSource),
     m_hasDebuggingHelper(false),
     m_hasQmlDump(false),
+    m_hasQmlDebuggingLibrary(false),
     m_hasQmlObserver(false),
     m_toolChainUpToDate(false),
     m_versionInfoUpToDate(false),
@@ -614,6 +619,7 @@ QtVersion::QtVersion()
     m_isAutodetected(false),
     m_hasDebuggingHelper(false),
     m_hasQmlDump(false),
+    m_hasQmlDebuggingLibrary(false),
     m_hasQmlObserver(false),
     m_toolChainUpToDate(false),
     m_versionInfoUpToDate(false),
@@ -791,6 +797,28 @@ QString QtVersion::qtVersionString() const
     return m_qtVersionString;
 }
 
+bool QtVersion::versionNumbers(int *majorNumber, int *minorNumber, int *patchNumber) const
+{
+    const QString versionString = qtVersionString();
+    if (versionString.isEmpty())
+        return false;
+
+    // check format
+    static QRegExp qtVersionRegex(QLatin1String("^\\d+\\.\\d+\\.\\d+$"));
+    if (!qtVersionRegex.exactMatch(versionString))
+        return false;
+
+    QStringList parts = versionString.split(QLatin1Char('.'));
+    if (majorNumber)
+        *majorNumber = parts.at(0).toInt();
+    if (minorNumber)
+        *minorNumber = parts.at(1).toInt();
+    if (patchNumber)
+        *patchNumber = parts.at(2).toInt();
+
+    return true;
+}
+
 QHash<QString,QString> QtVersion::versionInfo() const
 {
     updateVersionInfo();
@@ -1148,6 +1176,7 @@ void QtVersion::updateVersionInfo() const
     m_hasDocumentation = false;
     m_hasDebuggingHelper = false;
     m_hasQmlDump = false;
+    m_hasQmlDebuggingLibrary = false;
     m_hasQmlObserver = false;
 
     if (!queryQMakeVariables(qmakeCommand(), &m_versionInfo))
@@ -1160,6 +1189,9 @@ void QtVersion::updateVersionInfo() const
         if (!qtInstallData.isEmpty()) {
             m_hasDebuggingHelper = !DebuggingHelperLibrary::debuggingHelperLibraryByInstallData(qtInstallData).isEmpty();
             m_hasQmlDump = !QmlDumpTool::toolByInstallData(qtInstallData, false).isEmpty() || !QmlDumpTool::toolByInstallData(qtInstallData, true).isEmpty();
+            m_hasQmlDebuggingLibrary
+                    = !QmlDebuggingLibrary::libraryByInstallData(qtInstallData, false).isEmpty()
+                || !QmlDebuggingLibrary::libraryByInstallData(qtInstallData, true).isEmpty();
             m_hasQmlObserver = !QmlObserverTool::toolByInstallData(qtInstallData).isEmpty();
         }
     }
@@ -1648,7 +1680,7 @@ QString QtVersion::invalidReason() const
         return QCoreApplication::translate("QtVersion", "Qt version is not properly installed, please run make install");
     if (!m_versionInfo.contains("QT_INSTALL_BINS"))
         return QCoreApplication::translate("QtVersion",
-					   "Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?");
+                                           "Could not determine the path to the binaries of the Qt installation, maybe the qmake path is wrong?");
     if (m_toolChainUpToDate && m_mkspecFullPath.isEmpty())
         return QCoreApplication::translate("QtVersion", "The default mkspec symlink is broken.");
     return QString();
@@ -1699,12 +1731,19 @@ bool QtVersion::hasDebuggingHelper() const
     return m_hasDebuggingHelper;
 }
 
+
 bool QtVersion::hasQmlDump() const
 {
     updateVersionInfo();
     return m_hasQmlDump;
 }
 
+bool QtVersion::hasQmlDebuggingLibrary() const
+{
+    updateVersionInfo();
+    return m_hasQmlDebuggingLibrary;
+}
+
 bool QtVersion::hasQmlObserver() const
 {
     updateVersionInfo();
@@ -1740,6 +1779,14 @@ QString QtVersion::qmlDumpTool(bool debugVersion) const
     return QmlDumpTool::toolByInstallData(qtInstallData, debugVersion);
 }
 
+QString QtVersion::qmlDebuggingHelperLibrary(bool debugVersion) const
+{
+    QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");
+    if (qtInstallData.isEmpty())
+        return QString();
+    return QmlDebuggingLibrary::libraryByInstallData(qtInstallData, debugVersion);
+}
+
 QString QtVersion::qmlObserverTool() const
 {
     QString qtInstallData = versionInfo().value("QT_INSTALL_DATA");
diff --git a/src/plugins/qt4projectmanager/qtversionmanager.h b/src/plugins/qt4projectmanager/qtversionmanager.h
index 64f6f93d889bb8229365aa12128bee71bde3c442..479382ef8e39194cdb216dc4e2237093f9fc06a3 100644
--- a/src/plugins/qt4projectmanager/qtversionmanager.h
+++ b/src/plugins/qt4projectmanager/qtversionmanager.h
@@ -109,6 +109,8 @@ public:
     void setQMakeCommand(const QString &path);
 
     QString qtVersionString() const;
+    bool versionNumbers(int *majorNumber, int *minorNumber, int *patchNumber) const;
+
     // Returns the PREFIX, BINPREFIX, DOCPREFIX and similar information
     QHash<QString,QString> versionInfo() const;
 
@@ -129,12 +131,14 @@ public:
 
     bool hasDebuggingHelper() const;
     QString debuggingHelperLibrary() const;
+    QString qmlDebuggingHelperLibrary(bool debugVersion) const;
     QString qmlDumpTool(bool debugVersion) const;
     QString qmlObserverTool() const;
     QStringList debuggingHelperLibraryLocations() const;
     bool supportsBinaryDebuggingHelper() const;
 
     bool hasQmlDump() const;
+    bool hasQmlDebuggingLibrary() const;
     bool hasQmlObserver() const;
     Utils::Environment qmlToolsEnvironment() const;
 
@@ -196,6 +200,7 @@ private:
     QString m_autodetectionSource;
     mutable bool m_hasDebuggingHelper; // controlled by m_versionInfoUpToDate
     mutable bool m_hasQmlDump;         // controlled by m_versionInfoUpToDate
+    mutable bool m_hasQmlDebuggingLibrary; // controlled by m_versionInfoUpdate
     mutable bool m_hasQmlObserver;     // controlled by m_versionInfoUpToDate
 
     QString m_mwcDirectory;