2012-05-11

Good QML QtQuick C++ Tutorial (finally)

I searched long and hard for something like this, so I thought I'd pass it along to those who are Googling for the same thing.  There are tons of tutorials and samples and examples out there that use the Qt API with C++, but I found it quite difficult to find any complete and comprehensive tutorials and/or code that includes the method that integrates QML as the User Interface and C++ for the application logic.  Here's what I was looking for:

http://kgronholm.blogspot.com/2010/10/qt-quick-game-programming.html

or here

http://quitcoding.com/?page=work#qtquick

Thanks to Kaitsu and QUIt Coding for the good work and generosity.

Some notes on installation:

I had to install mesa-libGLU-devel in my Fedora 16 system in order to get the game to run.

I had another problem getting the game to run.  Although the project would build, when I tried to run it I would get an error saying "No such file or directory" referring to the "content" folder where all of the QML is kept.  The build was not copying this folder into the shadow build copy that it was then attempting to run from.

So I sent an email to QUItcoding.com.  Kaitsu answered me back very quickly and let me know that I only needed to disable "shadow build" under the build settings in the "projects" view ( found on the left side of QtCreator).  That fixed the issue immediately.

I should also mention that I replaced the line:
import Qt 4.7

at the top of all the .qml files with:
import QtQuick 1.0

I don't think this really mattered since the newer versions retain previous version functionality, but I thought I'd mention it anyway.



1 comment:

  1. Hi, I am writing a blackberry 10 application where I want to integrate C++ and QML (for the UI part). Will that tutorial you are referring to be useful/helpful to me? Thank you.
    Best Regards.

    ReplyDelete

Let me know what you think!