[quote author="YetAnotherNick" date="1296247560"]Hi! Is it possible to get the context that corresponds to a custom QDeclarativeItem that was instantiated in QML?
[/quote]
Yes, QDeclarativeEngine::contextForObject() returns the context of an object.
Wow, quick response. My bad, I was to quick to ask. I found the solution.
The idea was when there new item in the list, list would animate down, and new item would slide it from side. I made confusion with y instead x... :)
Thanks anyway!
I recently developed a multiplatform application running on Windows 7 and Windows CE and faced the same issue.
The best solution is to encapsulate all the "heavy/complex" stuff in QML Items coded in C++ (i.e. derived from QDeclarativeItem ) and eventually some models in C++ as johnk said.
Keeping all the "high level UI logic" in QML you can refactorize it quicker than using C++,
for example you can switch from using qml loader to load one page at a time
to loading all the pages in memory at startup without touching a line of C++.
"Reloading from C++" (i.e. QDeclarativeView::setSource() ) makes sense only when you need to purge all the previously allocated QML data to reclaim memory quickly or when for a reason or another you want to be sure the UI code and data of different pages is clearly separated (i.e. one set of pages is coded by you and the other by the final user for customizations and you want/need to keep 'em separated just in case the final user makes some modifications that may affect your stuff).
Because of the Windows CE requirement (read: a lot less memory available in the Windows CE devices) in my application I added that option too, but exposed the interface to the "C++ loader" on the QML side to let the UI coders decide when they really had to use it and they prefer to avoid it.
Ok, now lets take this to the next level...
I have created a control that contains a number of elements that can gain focus (an address control). How is focus controlled going from the container of the control to the control and then back out?
Example:
The current screen has:
a check box control: "Enable billing address separate from shipping address"
the 'address control' which starts with a TextInput control named fname and ends with a TextInput control named country.
a submit button
The focus should start on the check box control, setting the KeyNavigation.tab to the address control will get them to the fname TextInput.
How does the user get from the fname TextInput and backtab to the check box?
How does the user get from the country TextInput to the submit button?
How does the user get from the submit button and backtab to the country TextInput?
Sam
Some online documents that may get you started:
"How to learn Qt":http://doc.qt.nokia.com/4.7/how-to-learn-qt.html
"Getting Started Programming with Qt":http://doc.qt.nokia.com/4.7/gettingstartedqt.html (translations in the "wiki":http://developer.qt.nokia.com/wiki/Category:Learning::GettingStarted)
"Tutorials overview":http://doc.qt.nokia.com/4.7/tutorials.html
The learing section on the "DevNet Resources":http://developer.qt.nokia.com/resources Page
A list of "Books about Qt":http://qt.nokia.com/developer/books/
Hello,
Have you seen this "document":http://doc.qt.nokia.com/4.7/qdeclarativemodels.html#c-data-models with respect to using C++ models and QML views?
-jk
Thanks for sharing good knowledge, actually I was searching QML documentation for QSparqlResultsList element. Haven't seen any.
But seems still possible to find from its implementation code.
Hi, it would be easier to see the problem if you post some code here, to show how the bindings are created and how the objects respond to property changes.
Even better, thanks.
I think we're missing some tutorials on QML. There is no place (at least I don't see one) where you could find such information, apart from looking at API reference and trying to put something together yourself.
It actually gets worse than that, this wiki page on Forum Nokia suggest a totally akward and verbose solution:
http://wiki.forum.nokia.com/index.php/Using_QML_ListView