In previous chapters, we saw how to use slots and create custom slots to implement some functionality in response to a signal being emitted. Now, in this section, we will look at how to create custom signals that can be emitted and connected to other slots.
To create a custom signal, one needs to declare a method signature and mark it as a signal with the aid of the Q_OBJECT macro. When declared, signals don't have a return type, but they can accept parameters.
Let's get our feet wet with a project. As usual, a new folder should be created with the three (3) files, namely, main.cpp, mainwindow.cpp, and mainwindow.h.
In this example, we shall override mousePressEvent and emit a custom signal that will be connected to a slot ...