[SailfishDevel] QML C++ Integration not working in Sailfish

antonio.cano.gomez at ovi.com antonio.cano.gomez at ovi.com
Wed Feb 26 12:02:22 UTC 2014


Hi Andrey,

The output is: ReferenceError: bloomfilterdata is not defined

I am calling it from a .js

Some idea about how can I  make that this is also defined there.

Thanks!





El Miércoles 26 de febrero de 2014 12:18, Andrey Kozhevnikov <coderusinbox at gmail.com> escribió:
 
start app in terminal and show output please
>
>
>On 26.02.2014 17:15, antonio.cano.gomez at ovi.com wrote:
>
>Hi Thomas,
>>
>>I did both modification but the code does not work yet.
>>
>>Here is the new code:
>>
>>        QGuiApplication *app = SailfishApp::application(argc,
        argv);
>>        QQuickView *view = SailfishApp::createView();
>>
>>        Bloomfilters  * bloomfilters = new Bloomfilters();
>>       
        view->rootContext()->setContextProperty("bloomfiltersdata",
        bloomfilters);
>>       
        view->setSource(SailfishApp::pathTo("qml/bloomfilter.qml"));
>>        view->showFullScreen();
>>
>>        return app->exec();
>>
>>
>>El Miércoles 26 de febrero de 2014 12:01, Thomas Perl <th.perl at gmail.com> escribió:
>> 
>>On 2014-02-26 11:48, antonio.cano.gomez at ovi.com wrote: 
>>>
>>>> I tried this:
>>>>
>>>>        QGuiApplication *app =
                    SailfishApp::application(argc, argv);
>>>>        QQuickView *view =
                    SailfishApp::createView();
>>>>        Bloomfilters  * bloomfilters = new
                    Bloomfilters();
>>>>
                    view->setSource(SailfishApp::pathTo("qml/bloomfilter.qml"));
>>>>        view->showFullScreen();
>>>>
                    view->rootContext()->setContextProperty("Bloomfilters",
                    bloomfilters);
>>>>        return app->exec();
>>>>
>>>> But it is not working yet.
>>>
>>>Two things:
>>>
>>>  1. Call setContextProperty() right before before
                  setSource(), so it's 
>>>already available when the QML content is loaded.
>>>  2. Use lowercase for context property names
                  ("bloomfilters" instead of 
>>>"Bloomfilters"). In some places, QML interprets IDs
                  starting with an 
>>>upper case letter as a type name, and that won't work
                  then, therefore 
>>>stick to lowercase.
>>>
>>>
>>>HTH :)
>>>Thomas 
>>>
>>>
>>>
>>>
>>
>>
>>_______________________________________________
SailfishOS.org Devel mailing list
>
>
>_______________________________________________
>SailfishOS.org Devel mailing list
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.sailfishos.org/pipermail/devel/attachments/20140226/b7f68796/attachment.html>


More information about the Devel mailing list