The QML, what we’ve just written, is functional enough, but it's already becoming difficult to maintain. Our MasterView is getting a little long and difficult to read. When we come to change how our command buttons look, for example, aligning the icon and text, we will have to change it in four places. If we want to add a fifth button, we have to copy, paste, and edit a whole bunch of QML to do so. This is where reusable components come into play.
Components are exactly the same as the views we have already created—just snippets of QML. The difference is purely semantic. Throughout this book, views represent screens that lay out content while components are the content.
The easiest way to create a new component is when you have already written the QML that you want to form the basis for your component, which we have done. Right-click on any of the...