The basic QML UI I've built is on top of an element called "Box", which is in turn built on top of an element called "HideShowContainer".
The base of the acutal user interface is called Ui, and it contains all of the other UI elements (pause screen, battle screen, etc). If you're adding a completely new screen (such as a shop interface), start in Ui.qml and take a look at how the BattleScreen element is added.
Finally, as I've mentioned previously, there's some unfortunate ugliness in the code, because right now the QML engine doesn't function as a normal script engine, so I've got a separate QtScript engine and some hacks going on to allow me to access data across them. It appears as if Qt5 will alleviate this, but for now we're stuck with Qt 4.x, so the hacks will have to remain in place until the issue is fixed.
Eventually it would be good to move all of the game-related data structures (items, abilities, etc) into QML. This was written a while ago, but I think it was due to the fact that QML can't access QObjects the way QtScript can. Regardless, at this point I want to get the engine completely working rather than rewrite the ability and item handling stuff. :)
That being said, the Character data structure is built in QML, which allows for snazzy things to happen (like having the character status interface bound automatically to the character's status without any extra code).
I hope this helps at least a little bit. Feel free to post any questions you might have.
Hi bart,
you can export QObjects to qml and call their metafunctions. Q_Propertys with READ WRITE NOTIFY are even bindable. Same for QStandarditemModel (with some effort).
~ Similar code (out of memory):
A Class with an invokeable function as example :
public class MyClass : public QObject
{
public:
...
// All QVariant Types can be returned or taken as parameters
Q_INVOKABLE QMap<int, String> wickedFoo (String a, int b, float c);
...
}
C++:
MyClass *obj = new MyClass();
declarativeview->rootContext()->setContextProperty("myClass", obj);
QML:
var cppResultMap = myClass.wickedFoo(a, b, c);