Select File > New File or Project > QML > QML File > Choose... to create a QML file called Button.qml (for example).
Note: Components are listed in the Library pane only if the filename begins with a capital letter.
Click Design to edit the file in the visual editor.
In the Navigator pane, click Rectangle to set properties for it.
In the Properties pane, modify the appearance of the button.
In the Size field, set the width (W) and height (H) of the button.
In the Color field, select the button color.
In the Radius field, use the slider to set the radius of the rectangle and produce rounded corners for the button.
Drag and drop a Text item on top of the Rectangle. This creates a nested element where Rectangle is the parent element of Text. Elements are positioned relative to their parents.
In the Properties pane, edit the properties of the Text item.
In the Text field, type Button.
You can select the text color, font, size, and style in the Font section.
In the Alignment field, select the center buttons to align the text to the center of the button.
Click Layout, and then click the button to anchor the text to the whole button area.
Press Ctrl+S to save the button.
Note: To view the button, you must add it to a Qt Quick Application or Qt Quick UI project.