To define a signal and slot there is keywords within the “new” class structure available because of the Q_OBJECT and you can just use them like public and private declarations To allow for these slots and signals to be defined within the class you need to call the macro Q_OBJECT at the top of the class (within a private area) so that all of the necessary attachments to the class can be created (within the moc file associated with the class when you run the qmake later on). Where the valueChanged is the signal within the class definition (you do not define that function because it is kinder like a virtual function). This function will set the value and emit the signal for any QObject::connect to link to a slot. I have created a class called EmitterTest that has a function within it called For example if you want to link a value changed event then you would emit a signal from within the class and then use that signal with the QObject::connect to link to a slot within class as well. The basics of slot(s) and signal(s) with emit(ting) is that a slot is where the emit(ed) signal goes to, when a signal is emit(ed) via a class.
When you trying to link the slots and signals together you need to have a QObject::connect and also a emitting, I have created a basic demonstration of this with a QPushButton ( link to qt signal and slots, and a QT link for the signal and slots)