You can see that we have a new file called Button.qml in the project, which contains everything the button item used to have, with the exception of the id and anchors.centerIn properties. The main file was simplified to the following:
Window { visible: true width: 640 height: 480 title: qsTr("Hello World") Button { id: button anchors.centerIn: parent } }
Button has become a component—a definition of a new type of element that can be used the same way as standard QML element types. Remember that QML component names, as well as names of files representing them, need to begin with a capital letter! If you name a file button.qml instead of Button.qml, then you will not be able to use Button as a component name, and trying ...