Early on in this book, we looked at a component called MouseArea. This was soon superseded by our use of Button components, which provide the clicking functionality for us. However, now that we are rolling our own form of buttons, we need to implement the clicking functionality ourselves. Much like the Button components, our NavigationButton shouldn’t really do anything when they are clicked on, other than informing their parent that the event has occurred. Components should be as generic and ignorant about context as possible so that you can use them in multiple places. What we need to do is add a MouseArea component and simply pass on the onClicked event via a custom signal.
In NavigationButton, we first add the signal that we ...