diff options
author | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-10-01 15:41:04 +0200 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@theqtcompany.com> | 2015-10-20 16:15:10 +0000 |
commit | 703ce02d4c8963d789e5f64e4ac167ca77935037 (patch) | |
tree | 4401b2605b5c752ab024b7accd8b3c06cf9384f0 | |
parent | 14eafd5dca6b02c33653f452f2b4dbb667794bce (diff) | |
download | qt-creator-703ce02d4c8963d789e5f64e4ac167ca77935037.tar.gz |
Detach QML debugging option from qmakes build mode
The coupling of qml_debug to qmake's Debug profile is both brittle and
wrong. There are good reasons to also enable qml debugging in certain
Release builds and changing the build type of a specific build often
leaves the UI in an inconsistent state.
Change-Id: I89cb86849c984278ebfc54f66f139ec482b18d9a
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp | 5 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakestep.cpp | 31 | ||||
-rw-r--r-- | src/plugins/qmakeprojectmanager/qmakestep.h | 8 |
3 files changed, 16 insertions, 28 deletions
diff --git a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp index 470e92dd18..7f19728c9b 100644 --- a/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/qmakebuildconfiguration.cpp @@ -570,6 +570,8 @@ QmakeBuildInfo *QmakeBuildConfigurationFactory::createBuildInfo(const Kit *k, info->displayName = tr("Debug"); //: Non-ASCII characters in directory suffix may cause build issues. suffix = tr("Debug", "Shadow build directory suffix"); + if (version && version->qtVersion().majorVersion >= 5) + info->config.linkQmlDebuggingQQ2 = true; } info->typeName = info->displayName; // Leave info->buildDirectory unset; @@ -669,8 +671,7 @@ void QmakeBuildConfigurationFactory::configureBuildConfiguration(Target *parent, QString additionalArguments = qmakeInfo->additionalArguments; if (!additionalArguments.isEmpty()) qmakeStep->setUserArguments(additionalArguments); - if (!qmakeInfo->makefile.isEmpty()) - qmakeStep->setLinkQmlDebuggingLibrary(qmakeInfo->config.linkQmlDebuggingQQ2); + qmakeStep->setLinkQmlDebuggingLibrary(qmakeInfo->config.linkQmlDebuggingQQ2); qmakeStep->setSeparateDebugInfo(qmakeInfo->config.separateDebugInfo); qmakeStep->setUseQtQuickCompiler(qmakeInfo->config.useQtQuickCompiler); diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index 3ade2569e4..89d41094ac 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -324,23 +324,15 @@ void QMakeStep::setUserArguments(const QString &arguments) bool QMakeStep::linkQmlDebuggingLibrary() const { - if (m_linkQmlDebuggingLibrary == DoLink) - return true; - if (m_linkQmlDebuggingLibrary == DoNotLink) - return false; - - const Core::Context languages = project()->projectLanguages(); - if (!languages.contains(ProjectExplorer::Constants::LANG_QMLJS)) - return false; - return (qmakeBuildConfiguration()->buildType() & BuildConfiguration::Debug); + return m_linkQmlDebuggingLibrary; } void QMakeStep::setLinkQmlDebuggingLibrary(bool enable) { - if ((enable && (m_linkQmlDebuggingLibrary == DoLink)) - || (!enable && (m_linkQmlDebuggingLibrary == DoNotLink))) + if (enable == m_linkQmlDebuggingLibrary) return; - m_linkQmlDebuggingLibrary = enable ? DoLink : DoNotLink; + + m_linkQmlDebuggingLibrary = enable; emit linkQmlDebuggingLibraryChanged(); @@ -414,8 +406,7 @@ QVariantMap QMakeStep::toMap() const { QVariantMap map(AbstractProcessStep::toMap()); map.insert(QLatin1String(QMAKE_ARGUMENTS_KEY), m_userArgs); - map.insert(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), m_linkQmlDebuggingLibrary == DebugLink); - map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary == DoLink); + map.insert(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), m_linkQmlDebuggingLibrary); map.insert(QLatin1String(QMAKE_FORCED_KEY), m_forced); map.insert(QLatin1String(QMAKE_USE_QTQUICKCOMPILER), m_useQtQuickCompiler); map.insert(QLatin1String(QMAKE_SEPARATEDEBUGINFO_KEY), m_separateDebugInfo); @@ -427,13 +418,15 @@ 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_useQtQuickCompiler = map.value(QLatin1String(QMAKE_USE_QTQUICKCOMPILER), false).toBool(); + + // QMAKE_QMLDEBUGLIBAUTO_KEY was used in versions 2.3 to 3.5 (both included) to automatically + // change the qml_debug CONFIG flag based no the qmake build configuration. if (map.value(QLatin1String(QMAKE_QMLDEBUGLIBAUTO_KEY), false).toBool()) { - m_linkQmlDebuggingLibrary = DebugLink; + m_linkQmlDebuggingLibrary = + project()->projectLanguages().contains(ProjectExplorer::Constants::LANG_QMLJS) && + (qmakeBuildConfiguration()->qmakeBuildConfiguration() & BaseQtVersion::DebugBuild); } else { - if (map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool()) - m_linkQmlDebuggingLibrary = DoLink; - else - m_linkQmlDebuggingLibrary = DoNotLink; + m_linkQmlDebuggingLibrary = map.value(QLatin1String(QMAKE_QMLDEBUGLIB_KEY), false).toBool(); } m_separateDebugInfo = map.value(QLatin1String(QMAKE_SEPARATEDEBUGINFO_KEY), false).toBool(); diff --git a/src/plugins/qmakeprojectmanager/qmakestep.h b/src/plugins/qmakeprojectmanager/qmakestep.h index 7cb36f97f7..2c20b95260 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.h +++ b/src/plugins/qmakeprojectmanager/qmakestep.h @@ -124,12 +124,6 @@ class QMAKEPROJECTMANAGER_EXPORT QMakeStep : public ProjectExplorer::AbstractPro Q_OBJECT friend class Internal::QMakeStepFactory; - enum QmlLibraryLink { - DoNotLink = 0, - DoLink, - DebugLink - }; - // used in DebuggerRunConfigurationAspect Q_PROPERTY(bool linkQmlDebuggingLibrary READ linkQmlDebuggingLibrary WRITE setLinkQmlDebuggingLibrary NOTIFY linkQmlDebuggingLibraryChanged) @@ -184,7 +178,7 @@ private: bool m_forced = false; bool m_needToRunQMake = false; // set in init(), read in run() QString m_userArgs; - QmlLibraryLink m_linkQmlDebuggingLibrary = DebugLink; + bool m_linkQmlDebuggingLibrary = false; bool m_useQtQuickCompiler = false; bool m_scriptTemplate = false; bool m_separateDebugInfo = false; |