Time for action – creating a button component
As an exercise, let's try to use what you've learned so far to create a more complete and better working button component. The button is to have a rounded shape with a nice background and should hold definable text and an icon. The button should look good for different texts and icons.
Start by creating a new project in Qt Creator. Choose Qt Quick UI as the project type. When asked for the component set, choose the lowest available version of Qt Quick:
At this point, you should end up with a project containing two files–one with a QML project extension, which is your project management file, and the other with the QML extension, which is your main user interface file. You can see that both files contain QML definitions. That is because Qt Creator manages Qt Quick projects using QML itself (you'll notice it imports the QmlProject
module).
The QML document that was created for us contains a "Hello World" example...