Wednesday, 10 May 2017

QML: Sandbox

In order to learn QML and interactions between QML and C/Qt, I created a simple sandbox that I've published on my GitHub account.

Anyone is free to download and play around with the software (under GPL conditions). However, I strongly recommend you to learn QML step-by-step and build a QML application from scratch.

The QML is created from C++:

The QML file has some static items that are defined from the beginning. Those items has some attributes that defines their appearance. Also, new items can be created dynamically.

  • A blue rectangle in the top left corner. Inside that rectangle, there is a text. When clicking in the rectangle, two things will happen:
    • Another QML item will change color from green to blue. 
    • A text will appear to the left, rotate 360 degrees and fade away. That text is created from a JavaScript that creates the item in the file sprite.qml
    • A blue rectangle in the top left corner. Inside that rectangle, there is a text. When clicking in the 
  • A blue text field below the blue rectangle, that turns green when the rectangle above is clicked
  • A blue text field that turns golden when a function in C++ is launched.
  • One of the rotating text fields to the right is re-coloured to red from C++ 
  • The faded blue square is created from a string.

The process of creating this program has taught me how to create QML objects and how to interact with C++ in a sandbox.

No comments:

Post a Comment