Commit f13c6aeb authored by Marco Bubke's avatar Marco Bubke
Browse files

QmlDesigner: Fix inline component support

parent 0e2e3874
......@@ -756,7 +756,11 @@ QObject *createPrimitive(const QString &typeName, int majorNumber, int minorNumb
QObject *object = 0;
QDeclarativeType *type = QDeclarativeMetaType::qmlType(typeName.toUtf8(), majorNumber, minorNumber);
if (type) {
object = type->create();
if (type->typeName() == "QDeclarativeComponent") {
object = new QDeclarativeComponent(context->engine(), 0);
} else {
object = type->create();
}
} else {
qWarning() << "QuickDesigner: Cannot create an object of type"
<< QString("%1 %2,%3").arg(typeName).arg(majorNumber).arg(minorNumber)
......
......@@ -219,6 +219,12 @@ static inline QVariant convertDynamicPropertyValueToVariant(const QString &astVa
}
}
static bool isComponentType(const QString &type)
{
qDebug() << __FUNCTION__ << type;
return type == QLatin1String("Component") || type == QLatin1String("Qt/Component") || type == QLatin1String("QtQuick/Component");
}
} // anonymous namespace
namespace QmlDesigner {
......@@ -992,7 +998,7 @@ void TextToModelMerger::syncNodeListProperty(NodeListProperty &modelListProperty
QString name;
if (UiObjectDefinition *definition = cast<UiObjectDefinition *>(arrayMember))
name = flatten(definition->qualifiedTypeNameId);
if (name == QLatin1String("Qt/Component"))
if (isComponentType(name))
setupComponent(newNode);
}
......@@ -1319,7 +1325,7 @@ void ModelAmender::idsDiffer(ModelNode &modelNode, const QString &qmlId)
void TextToModelMerger::setupComponent(const ModelNode &node)
{
Q_ASSERT(node.type() == QLatin1String("Qt/Component"));
Q_ASSERT(isComponentType(node.type()));
QString componentText = m_rewriterView->extractText(QList<ModelNode>() << node).value(node);
......
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