diff --git a/src/plugins/qmlprojectmanager/qmlproject.cpp b/src/plugins/qmlprojectmanager/qmlproject.cpp index 43707de1ad4244d4afebc727502d487451e7e824..fd1a1bc9e5bd4dca03bc5d3706cca87c2cd67f4f 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.cpp +++ b/src/plugins/qmlprojectmanager/qmlproject.cpp @@ -343,7 +343,7 @@ QmlRunConfiguration::QmlRunConfiguration(QmlProject *pro) + Utils::SynchronousProcess::pathSeparator() + QCoreApplication::applicationDirPath() ; - m_qmlViewer = Utils::SynchronousProcess::locateBinary(searchPath, QLatin1String("qmlviewer")); + m_qmlViewerDefaultPath = Utils::SynchronousProcess::locateBinary(searchPath, QLatin1String("qmlviewer")); } QmlRunConfiguration::~QmlRunConfiguration() @@ -357,8 +357,9 @@ QString QmlRunConfiguration::type() const QString QmlRunConfiguration::executable() const { - // No need to verify if the QML Viewer exists. The console will tell us anyway when we try to launch it. - return m_qmlViewer; + if (!m_qmlViewerCustomPath.isEmpty()) + return m_qmlViewerCustomPath; + return m_qmlViewerDefaultPath; } QmlRunConfiguration::RunMode QmlRunConfiguration::runMode() const @@ -469,7 +470,7 @@ void QmlRunConfiguration::setMainScript(const QString &scriptFile) void QmlRunConfiguration::onQmlViewerChanged() { if (Utils::PathChooser *chooser = qobject_cast<Utils::PathChooser *>(sender())) { - m_qmlViewer = chooser->path(); + m_qmlViewerCustomPath = chooser->path(); } } @@ -483,7 +484,7 @@ void QmlRunConfiguration::save(ProjectExplorer::PersistentSettingsWriter &writer { ProjectExplorer::LocalApplicationRunConfiguration::save(writer); - writer.saveValue(QLatin1String("qmlviewer"), m_qmlViewer); + writer.saveValue(QLatin1String("qmlviewer"), m_qmlViewerCustomPath); writer.saveValue(QLatin1String("qmlviewerargs"), m_qmlViewerArgs); writer.saveValue(QLatin1String("mainscript"), m_scriptFile); } @@ -492,24 +493,10 @@ void QmlRunConfiguration::restore(const ProjectExplorer::PersistentSettingsReade { ProjectExplorer::LocalApplicationRunConfiguration::restore(reader); - m_qmlViewer = reader.restoreValue(QLatin1String("qmlviewer")).toString(); + m_qmlViewerCustomPath = reader.restoreValue(QLatin1String("qmlviewer")).toString(); m_qmlViewerArgs = reader.restoreValue(QLatin1String("qmlviewerargs")).toString(); m_scriptFile = reader.restoreValue(QLatin1String("mainscript")).toString(); - if (m_qmlViewer.isEmpty()) { - // first see if there is a bundled qmlviewer -#ifdef Q_OS_WIN32 - const QLatin1String qmlViewerExe("qmlviewer.exe"); -#else - const QLatin1String qmlViewerExe("qmlviewer"); -#endif - const QFileInfo info(QCoreApplication::applicationDirPath(), qmlViewerExe); - if (info.exists() && info.isExecutable()) - m_qmlViewer = info.absoluteFilePath(); - else // if not, then try to locate it elsewhere - m_qmlViewer = Utils::SynchronousProcess::locateBinary(QLatin1String("qmlviewer")); - } - if (m_scriptFile.isEmpty()) m_scriptFile = tr("<Current File>"); } diff --git a/src/plugins/qmlprojectmanager/qmlproject.h b/src/plugins/qmlprojectmanager/qmlproject.h index 9e81a04d1eee3c18dedf3bc3f9b8f00fa1fe1302..d3454177311939808020f9c136d1271afd9a3b1d 100644 --- a/src/plugins/qmlprojectmanager/qmlproject.h +++ b/src/plugins/qmlprojectmanager/qmlproject.h @@ -175,7 +175,8 @@ private: private: QmlProject *m_project; QString m_scriptFile; - QString m_qmlViewer; + QString m_qmlViewerCustomPath; + QString m_qmlViewerDefaultPath; QString m_qmlViewerArgs; QLatin1String m_type; };