Re: [SailfishDevel] Alpha 2: passing simple properties from main.cpp to qml: A bug?

2013-08-04 Thread christopher . lamb
Salut Lucien Maybe it is clearer with Code examples I was doing this, which gives me an error, but seems to work! Q_DECL_EXPORT int main(int argc, char *argv[]) { QScopedPointer app(Sailfish::createApplication(argc, argv)); QScopedPointer view(Sailfish::createView("main.qml")); v

Re: [SailfishDevel] Alpha 2: passing simple properties from main.cpp to qml: A bug?

2013-08-04 Thread Lucien XU
Hello guys ! It might be useful to use qmlRegister**Type (uncreatable, singleton etc.) to expose C++ components to QML. But if you really want to use rootContext()- >setContextProperty, you have to be cautious. Actually, if you pass the qml file to the view before registering C++ components, th

Re: [SailfishDevel] Alpha 2: passing simple properties from main.cpp to qml: A bug?

2013-08-04 Thread christopher . lamb
Hi Martin Curiouser and Curiouser! Just to be sure, I went back and tested your suggestion in a demo project based on the default "Hello Sailors" new project template. Here I pass the c++ property cppproperty with the value "Hello World". In the QML FirstPage this is concatenated to the "H

Re: [SailfishDevel] Alpha 2: passing simple properties from main.cpp to qml

2013-08-04 Thread Ville M. Vainio
Also, there is qt-project.org/doc/qt-5.0/qtqml/qqmlengine.html#qmlRegisterSingletonType On Aug 4, 2013 3:31 PM, "Martin Grimme" wrote: > Hi, > > you don't want to set the context property on the > QmlApplicationViewer, which was dead Nokia code to target Symbian and > Harmattan, anyway. > QmlApp

Re: [SailfishDevel] Alpha 2: passing simple properties from main.cpp to qml

2013-08-04 Thread Martin Grimme
Hi, you don't want to set the context property on the QmlApplicationViewer, which was dead Nokia code to target Symbian and Harmattan, anyway. QmlApplicationViewer was derived from QmlView, where it got the rootContext() method from. With Qt5, QmlView was renamed to QQuickView. And when using the

[SailfishDevel] Alpha 2: passing simple properties from main.cpp to qml

2013-08-04 Thread christopher . lamb
Hi all What is the recommended way to pass simple c++ properties from the main.cpp to the QML part of a project using the Qt 5 Alpha? In the good old days of the first Alpha, I used to do this Harmattan style using QmlApplicationViewer viewer; viewer.rootContext()->setContextPrope