Commit 5778a393 authored by Tim Jenssen's avatar Tim Jenssen
Browse files

QmlDesigner: read window mock from file



Change-Id: Ic525b1d3ac18c42c6abb6a93195e220465dd017f
Reviewed-by: default avatarTim Jenssen <tim.jenssen@digia.com>
parent 67a5cc39
import QtQuick 2.2
Rectangle {
property string title
}
......@@ -1089,17 +1089,9 @@ static bool isCrashingType(QQmlType *type)
return false;
}
static QObject *createDummyWindow(QQmlContext *context, const QUrl &sourceUrl)
static QObject *createDummyWindow(QQmlContext *context)
{
QQmlComponent component(context->engine());
QByteArray dummyWindow;
dummyWindow.append("import QtQuick 2.0\n");
dummyWindow.append("Rectangle {\n");
dummyWindow.append("property string title\n");
dummyWindow.append("}\n");
component.setData(dummyWindow, sourceUrl);
QQmlComponent component(context->engine(), QUrl(QStringLiteral("qrc:/qtquickplugin/mockfiles/Window.qml")));
return component.create();
}
......@@ -1137,10 +1129,12 @@ QObject *ObjectNodeInstance::createPrimitive(const QString &typeName, int majorN
if (isWindow(object)) {
delete object;
object = createDummyWindow(context, type->sourceUrl());
object = createDummyWindow(context);
}
} else {
}
if (!object) {
qWarning() << "QuickDesigner: Cannot create an object of type"
<< QString("%1 %2,%3").arg(typeName).arg(majorNumber).arg(minorNumber)
<< "- type isn't known to declarative meta type system";
......
......@@ -3,5 +3,6 @@
<file>images/template_image.png</file>
<file>html/welcome.html</file>
<file>images/webkit.png</file>
<file>mockfiles/Window.qml</file>
</qresource>
</RCC>
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