Commit 7ca474b2 authored by Kai Koehne's avatar Kai Koehne
Browse files

Update debugger language aspect in run settings when qmake step changes

When QML language debugging hasn't been set to a fixed state yet by the
user try to find a qmake step to decide whether to enable QML debugging by default
or not.

This is a hack, breaking the separation between qt build steps and debugger
run settings. However, adding a generic project infrastructure for this specific
use case is probably overkill...

Task-number: QTCREATORBUG-11474
Change-Id: Ib65c8474b9b7ec187769c209531ff56bc8293cde
Reviewed-by: default avatarAurindam Jana <>
Reviewed-by: default avatarEike Ziller <>
Reviewed-by: default avatarAlessandro Portale <>
parent 76afffe4
......@@ -39,6 +39,9 @@
#include <projectexplorer/projectexplorerconstants.h>
#include <projectexplorer/runconfiguration.h>
#include <projectexplorer/target.h>
#include <projectexplorer/buildconfiguration.h>
#include <projectexplorer/buildstep.h>
#include <projectexplorer/buildsteplist.h>
#include <QCheckBox>
#include <QSpinBox>
......@@ -53,6 +56,8 @@ static const char USE_QML_DEBUGGER_AUTO_KEY[] = "RunConfiguration.UseQmlDebugger
static const char QML_DEBUG_SERVER_PORT_KEY[] = "RunConfiguration.QmlDebugServerPort";
static const char USE_MULTIPROCESS_KEY[] = "RunConfiguration.UseMultiProcess";
using namespace ProjectExplorer;
namespace Debugger {
namespace Internal {
......@@ -70,13 +75,15 @@ public:
explicit DebuggerRunConfigWidget(DebuggerRunConfigurationAspect *aspect);
QString displayName() const { return tr("Debugger Settings"); }
void showEvent(QShowEvent *event);
void update();
private slots:
void useCppDebuggerClicked(bool on);
void useQmlDebuggerToggled(bool on);
void useQmlDebuggerClicked(bool on);
void qmlDebugServerPortChanged(int port);
void useMultiProcessToggled(bool on);
void update();
DebuggerRunConfigurationAspect *m_aspect; // not owned
......@@ -139,10 +146,19 @@ DebuggerRunConfigWidget::DebuggerRunConfigWidget(DebuggerRunConfigurationAspect
connect(aspect->runConfiguration()->target()->project(), SIGNAL(projectLanguagesUpdated()),
this, SLOT(update()));
void DebuggerRunConfigWidget::showEvent(QShowEvent *event)
// Update the UI on every show() because the state of
// QML debugger language is hard to track.
// !event->spontaneous makes sure we ignore e.g. global windows events,
// when Qt Creator itself is minimized/maximized.
if (!event->spontaneous())
void DebuggerRunConfigWidget::update()
......@@ -233,6 +249,20 @@ bool DebuggerRunConfigurationAspect::useCppDebugger() const
bool DebuggerRunConfigurationAspect::useQmlDebugger() const
if (m_useQmlDebugger == DebuggerRunConfigurationAspect::AutoEnabledLanguage) {
// Try to find a build step (qmake) to check whether qml debugging is enabled there
// (Using the Qt metatype system to avoid a hard qt4projectmanager dependency)
if (BuildConfiguration *bc = runConfiguration()->target()->activeBuildConfiguration()) {
if (BuildStepList *bsl = bc->stepList(ProjectExplorer::Constants::BUILDSTEPS_BUILD)) {
foreach (BuildStep *step, bsl->steps()) {
QVariant linkProperty = step->property("linkQmlDebuggingLibrary");
if (linkProperty.isValid() && linkProperty.canConvert(QVariant::Bool))
return linkProperty.toBool();
const Core::Context languages = runConfiguration()->target()->project()->projectLanguages();
return languages.contains(ProjectExplorer::Constants::LANG_QMLJS)
&& !languages.contains(ProjectExplorer::Constants::LANG_CXX);
......@@ -82,6 +82,9 @@ class QMAKEPROJECTMANAGER_EXPORT QMakeStep : public ProjectExplorer::AbstractPro
// used in DebuggerRunConfigurationAspect
Q_PROPERTY(bool linkQmlDebuggingLibrary READ linkQmlDebuggingLibrary WRITE setLinkQmlDebuggingLibrary NOTIFY linkQmlDebuggingLibraryChanged)
explicit QMakeStep(ProjectExplorer::BuildStepList *parent);
virtual ~QMakeStep();
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment