Commit 6841707e authored by Thomas Hartmann's avatar Thomas Hartmann
Browse files

QmlDesigner: support for QtQuick 1.0

This add preliminary support for import QtQuick 1.0
The RewriterView does type conversion from QtQuick to Qt
so Bauhaus does not have to deal with ambiguities.

Reviewed-by: Marco Bubke
parent 1a00bf95
......@@ -277,6 +277,12 @@ void RewriterView::importAdded(const Import &import)
if (textToModelMerger()->isActive())
return;
if (import.url() == "Qt")
foreach (const Import &import, model()->imports()) {
if (import.url() == "QtQuick")
return; //QtQuick magic we do not have to add an import for Qt
}
modelToTextMerger()->addImport(import);
if (!isModificationGroupActive())
......
......@@ -77,7 +77,27 @@ static inline QString deEscape(const QString &value)
return result;
}
static inline int fixUpMajorVersionForQtQuick(const QString &value, int i)
{
if (i = 1 && value == "QtQuick")
return 4;
else return i;
}
static inline int fixUpMinorVersionForQtQuick(const QString &value, int i)
{
if (i = 0 && value == "QtQuick")
return 7;
else return i;
}
static inline QString fixUpPackeNameForQtQuick(const QString &value)
{
if (value == "QtQuick")
return "Qt";
return value;
}
static inline bool isSignalPropertyName(const QString &signalName)
{
......@@ -232,9 +252,11 @@ public:
const Interpreter::QmlObjectValue * qmlValue = dynamic_cast<const Interpreter::QmlObjectValue *>(value);
if (qmlValue) {
typeName = qmlValue->packageName() + QLatin1String("/") + qmlValue->className();
majorVersion = qmlValue->version().major();
minorVersion = qmlValue->version().minor();
typeName = fixUpPackeNameForQtQuick(qmlValue->packageName()) + QLatin1String("/") + qmlValue->className();
//### todo this is just a hack to support QtQuick 1.0
majorVersion = fixUpMajorVersionForQtQuick(qmlValue->packageName(), qmlValue->version().major());
minorVersion = fixUpMinorVersionForQtQuick(qmlValue->packageName(), qmlValue->version().minor());
} else {
for (UiQualifiedId *iter = astTypeNode; iter; iter = iter->next)
if (!iter->next && iter->name)
......@@ -590,17 +612,6 @@ bool TextToModelMerger::load(const QString &data, DifferenceHandler &differenceH
setupImports(doc, differenceHandler);
foreach (const Import &import, m_rewriterView->model()->imports()) {
if (import.url() == "QtQuick") {
QList<RewriterView::Error> errors;
RewriterView::Error error(QCoreApplication::translate("QmlDesigner::TextToModelMerger",
"Unsupported import:\nimport QtQuick 1.0 use import Qt 4.7 instead"));
errors.append(error);
m_rewriterView->setErrors(errors);
return false;
}
}
UiObjectMember *astRootNode = 0;
if (UiProgram *program = doc->qmlProgram())
if (program->members)
......
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