Topic participates in the contest
"Smart phones for smart posts .
"I have long wanted to look at QtQuick and QML, and here is the reason. I planned to start classically with Hello World, but when I create a new project, Qt Creator generates Hello World, so that I cannot heroically write it myself. Well, then swing at something bigger. We will write a program that, when launched, would show something random, but beautiful and inspiring, and on click, it would close anywhere. I like the
pictures of nature . What touched me deeply is the fact that I wrote this program in an unfamiliar IDE and in a virtually unfamiliar language in about 500 seconds, 400 of whom understood Qt Creator and read one short tutorial.

')
So, we put Qt SDK, we start Qt Creator.
We create a new project like “Qt Quick Application” (in the wizard of project creation you can leave everything by default). As a result, we get the same Hello world, which I mentioned at the beginning:
import QtQuick 1.0 Rectangle { width: 360 height: 360 Text { text: qsTr("Hello World") anchors.centerIn: parent } MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } } }
Push the button "Design" - we get into the designer. Delete the "
Text " element in the Navigator. Instead, from the Library (panel below), select the component "
Image " and throw it on the form. Next on the “Layout” tab, click the “Fill ancestor” button, which will stretch our image to the full shape.
For those who are bored halfway, we will take a break right now: go to the "
Image " tab and insert the link in the "Source" field:
http://media.oboobs.ru/boobs/05055.jpg
Press Ctrl + R. Here it is our program, which is already pleasing to the eye!

But that was not the point. We need a variety, which means the picture must be different each time. This is done so easily that you do not even have time to blink an eye. To do this, go to the Editor (the button on the upper left) and change the code to this:
import QtQuick 1.0 Rectangle { width: 360 height: 360 MouseArea { anchors.fill: parent onClicked: { Qt.quit(); } Image { id: image1 anchors.fill: parent source: "http://media.oboobs.ru/boobs/"+ getPictureId() + ".jpg" function getPictureId(number, length) { var str = '' + Math.round(Math.random() * 5055); while (str.length < 5) { str = '0' + str; } return str; } } } }
We just added link generation based on the getPictureId function call, which returns values ​​from 00000 to 05055 (the last image on the site at the moment).
That's all - we have a program that works immediately on a pile of mobile and desktop platforms, which even at leisure can be launched once or twice to set the mood. And everything was done in just a couple of minutes. Honestly, I was completely blown away by such simplicity. The threshold for entry into QML development is extremely low, and you can make (given the ability to use the full power of Qt and C ++) a project of any complexity.
Dare!