[Qt-qml] setData for insert code in qml
marvin42
tourde_a at live.fr
Tue Nov 9 14:27:29 CET 2010
Hi
I want insert code in qml.
i have file main.qml, i try append this code import Qt 4.7\n Rectangle {
width : 1000; height:1000; color: \"blue\" }
ex:
QApplication app(argc, argv);
QDeclarativeView view;
QDeclarativeContext *context = new
QDeclarativeContext(view.rootContext());
QDeclarativeComponent component(view.engine());
component.setData("import Qt 4.7\n Rectangle { width : 1000;
height:1000; color: \"blue\" }", QUrl("main.qml"));
component.create(context);
view.setSource(QUrl("main.qml"));
view.show();
return app.exec();
But this code don't run.
--
marvin42
More information about the Qt-qml
mailing list