I will begin a series of lessons on
to customize a button, or better to say with styling, as in this case the term is more appropriate. We will not invoke the dialog boxes in this tutorial, but just do your
QML Cutom Button
, which will change color when you click on it. And there will be two for clarity, these buttons.
The first button will be red with a black border and black text, and when pressed, it will change the background color to black with red border and red text. The second button will have the same colors, but in the opposite sequence.
Project structure of QML Custom Button
The project is created in QtCreator as the application project with Qt Quick Quick Controls elements. In fact, there already is menyubar, multiple conversations and a couple of buttons. So, throw out all but two buttons and go to customize them.
And the structure of the project, in this case get the following:
- project profile;
- deployment profile;
- source file with main function;
- resource file for images, qml files and so on;
- main qml file;
- resource qml file for using with qml designer