forked from qt-creator/qt-creator
QmlProject: Allow different QML viewers per project
Change-Id: I7ca136fe1cf51b8335a15b1b2b7ea838e4859f78 Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
@@ -56,6 +56,11 @@ QmlProjectRunConfiguration::QmlProjectRunConfiguration(Target *target, Id id)
|
||||
: RunConfiguration(target, id)
|
||||
{
|
||||
addAspect<QmlProjectEnvironmentAspect>();
|
||||
m_qmlViewerAspect = addAspect<BaseStringAspect>();
|
||||
m_qmlViewerAspect->setLabelText(tr("QML viewer:"));
|
||||
m_qmlViewerAspect->setPlaceHolderText(executable());
|
||||
m_qmlViewerAspect->setDisplayStyle(BaseStringAspect::LineEditDisplay);
|
||||
|
||||
setOutputFormatter<QtSupport::QtOutputFormatter>();
|
||||
|
||||
// reset default settings in constructor
|
||||
@@ -98,6 +103,10 @@ QString QmlProjectRunConfiguration::disabledReason() const
|
||||
|
||||
QString QmlProjectRunConfiguration::executable() const
|
||||
{
|
||||
const QString qmlViewer = m_qmlViewerAspect->value();
|
||||
if (!qmlViewer.isEmpty())
|
||||
return qmlViewer;
|
||||
|
||||
BaseQtVersion *version = QtKitInformation::qtVersion(target()->kit());
|
||||
if (!version) // No Qt version in Kit. Don't try to run qmlscene.
|
||||
return QString();
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "qmlprojectmanager_global.h"
|
||||
|
||||
#include <projectexplorer/runconfiguration.h>
|
||||
#include <projectexplorer/runconfigurationaspects.h>
|
||||
|
||||
namespace Core { class IEditor; }
|
||||
|
||||
@@ -62,6 +63,7 @@ public:
|
||||
QVariantMap toMap() const override;
|
||||
|
||||
ProjectExplorer::Abi abi() const override;
|
||||
ProjectExplorer::BaseStringAspect *qmlViewerAspect() const { return m_qmlViewerAspect; }
|
||||
|
||||
signals:
|
||||
void scriptSourceChanged();
|
||||
@@ -82,6 +84,7 @@ private:
|
||||
|
||||
QString m_scriptFile;
|
||||
QString m_qmlViewerArgs;
|
||||
ProjectExplorer::BaseStringAspect *m_qmlViewerAspect;
|
||||
};
|
||||
|
||||
namespace Internal {
|
||||
|
||||
@@ -51,6 +51,7 @@ QmlProjectRunConfigurationWidget::QmlProjectRunConfigurationWidget(QmlProjectRun
|
||||
m_fileListModel(new QStandardItemModel(this))
|
||||
{
|
||||
auto form = new QFormLayout(this);
|
||||
rc->qmlViewerAspect()->addToConfigurationLayout(form);
|
||||
|
||||
m_fileListCombo = new QComboBox;
|
||||
m_fileListCombo->setModel(m_fileListModel);
|
||||
|
||||
Reference in New Issue
Block a user