Commit 9ee73a4f authored by Thomas Hartmann's avatar Thomas Hartmann

QmlDesigner: Add support for .ui.qml

Change-Id: Iec0663147a9072d8332cf05ad56bcb7db0253eda
Reviewed-by: default avatarAlessandro Portale <alessandro.portale@digia.com>
parent 685bc9f0
...@@ -68,7 +68,8 @@ static inline QStringList supportedVersionsList() ...@@ -68,7 +68,8 @@ static inline QStringList supportedVersionsList()
QStringList list; QStringList list;
list << QStringLiteral("1.0") << QStringLiteral("1.1") list << QStringLiteral("1.0") << QStringLiteral("1.1")
<< QStringLiteral("2.0") << QStringLiteral("2.1") << QStringLiteral("2.0") << QStringLiteral("2.1")
<< QStringLiteral("2.2") << QStringLiteral("2.3"); << QStringLiteral("2.2") << QStringLiteral("2.3")
<< QStringLiteral("2.4");
return list; return list;
} }
...@@ -842,7 +843,13 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH ...@@ -842,7 +843,13 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
try { try {
Snapshot snapshot = m_rewriterView->textModifier()->qmljsSnapshot(); Snapshot snapshot = m_rewriterView->textModifier()->qmljsSnapshot();
const QString fileName = url.toLocalFile(); const QString fileName = url.toLocalFile();
Document::MutablePtr doc = Document::create(fileName.isEmpty() ? QStringLiteral("<internal>") : fileName, Dialect::Qml);
Dialect dialect = ModelManagerInterface::guessLanguageOfFile(fileName);
if (dialect == Dialect::AnyLanguage
|| dialect == Dialect::NoLanguage)
dialect = Dialect::Qml;
Document::MutablePtr doc = Document::create(fileName.isEmpty() ? QStringLiteral("<internal>") : fileName, dialect);
doc->setSource(data); doc->setSource(data);
doc->parseQml(); doc->parseQml();
......
...@@ -37,6 +37,8 @@ ...@@ -37,6 +37,8 @@
#include <qmljseditor/qmljseditorconstants.h> #include <qmljseditor/qmljseditorconstants.h>
#include <qmljstools/qmljstoolsconstants.h>
#include <coreplugin/actionmanager/actionmanager.h> #include <coreplugin/actionmanager/actionmanager.h>
#include <coreplugin/coreconstants.h> #include <coreplugin/coreconstants.h>
#include <coreplugin/designmode.h> #include <coreplugin/designmode.h>
...@@ -154,7 +156,8 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e ...@@ -154,7 +156,8 @@ bool QmlDesignerPlugin::initialize(const QStringList & /*arguments*/, QString *e
void QmlDesignerPlugin::extensionsInitialized() void QmlDesignerPlugin::extensionsInitialized()
{ {
QStringList mimeTypes; QStringList mimeTypes;
mimeTypes.append("application/x-qml"); mimeTypes.append(QmlJSTools::Constants::QML_MIMETYPE);
mimeTypes.append(QmlJSTools::Constants::QMLUI_MIMETYPE);
Core::DesignMode::instance()->registerDesignWidget(data->mainWidget, mimeTypes, data->context->context()); Core::DesignMode::instance()->registerDesignWidget(data->mainWidget, mimeTypes, data->context->context());
connect(Core::DesignMode::instance(), connect(Core::DesignMode::instance(),
......
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