I am new to Qt, and am using Qt Creator 2.4.1 for development.
Question – Where can I find (or What are the) examples built using QML and C++?
I have been searching and its been not very fruitful. Like I have found examples using pure QML. Or the demo “samegame” uses javascript with QML.
Just to try out, here is some code I wrote in main.cpp –
QDeclarativeView view;
view.rootContext()->setContextProperty("game", new Game);
view.setSource(QUrl("qml/hangman/main.qml"));
view.show();
The question related to code – If I were to use C++ and QML, is this how the code in main() is supposed to be?
In the main.qml I will make all the different types of buttons, and mouseareas required.
Here’s examples from Qt documentation. You may see C++ code in most examples.
Usually, the main function is as below:
Extending QML Functionalities using C++ is good article too.