04-03-2014 04:58 AM
what I wanna do is dynamically load html code into webview of an app. Which means I generate some html-code fill it with a string and then put this with certain style-options into the WebView option of qml.
I'm new to BlackBerry app development and not sure how to start here. Can anyone give me a hint?
Solved! Go to Solution.
04-03-2014 05:04 AM
WebView takes a direct text as source code, as well as URLs, so just creating a QString and setting the html property to that QString would suffice.
Take a look at this to understand WebView better...
04-03-2014 05:19 AM
Thanks for the link.
I see I have to describe more precise what I wanna do because in involves C++.
What I want to do is generating a C++ class in which I can generate html code. I have read that to use C++ objects in QML you have to use QObjects, define QProperties and to make the function you want to use in qml invokable use Q_INVOKABLE, like described here:
Now I'm not quite sure how to generate a html-code with this tutorial. And how to make my app read this generated html-code in WebView.
04-03-2014 05:29 AM
That's a different question really and one that I think needs you to play around with creating your own custom control classes until you understand the concept.
However the basics will be;
Create a Class derived from QObject
Add a QProperty something like myHtml
Write the dynamic html code in the class
Expose the class to QML
Include your library in the QML page
Add the myHtml property of your QObject class to WebView's html property
It probably seems complicated at the start but there are many examples in the samples so I suggest you download a few of those and work through understanding them.