Commit ceca9d9d authored by Kai Koehne's avatar Kai Koehne
Browse files

Disable "Qt Quick->Preview" action if no qmlviewer in the PATH

An error dialog would be more explicit, but too late because of string
freeze.
parent e28e1f0c
......@@ -133,7 +133,9 @@ bool QmlJSEditorPlugin::initialize(const QStringList & /*arguments*/, QString *e
Core::Command *cmd = addToolAction(m_actionPreview, am, toolsMenuContext,
QLatin1String("QtQuick.Preview"), menuQtQuick, tr("Ctrl+Alt+R"));
connect(cmd->action(), SIGNAL(triggered()), SLOT(openPreview()));
m_previewRunner = new QmlJSPreviewRunner(this);
m_actionPreview->setEnabled(m_previewRunner->isReady());
QAction *followSymbolUnderCursorAction = new QAction(tr("Follow Symbol Under Cursor"), this);
cmd = am->registerAction(followSymbolUnderCursorAction, Constants::FOLLOW_SYMBOL_UNDER_CURSOR, context);
......
......@@ -24,6 +24,10 @@ QmlJSPreviewRunner::QmlJSPreviewRunner(QObject *parent) :
m_applicationLauncher.setEnvironment(environment.toStringList());
}
bool QmlJSPreviewRunner::isReady() const
{
return !m_qmlViewerDefaultPath.isEmpty();
}
void QmlJSPreviewRunner::run(const QString &filename)
{
......
......@@ -13,6 +13,8 @@ class QmlJSPreviewRunner : public QObject
Q_OBJECT
public:
explicit QmlJSPreviewRunner(QObject *parent = 0);
bool isReady() const;
void run(const QString &filename);
signals:
......
Markdown is supported
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