I have a joystick reader program. When a button of the joystick is pressed, a signal needs to be emitted.
How to choose which signal needs to be emitted?
Is there a list of the signals somewhere?
Printable View
I have a joystick reader program. When a button of the joystick is pressed, a signal needs to be emitted.
How to choose which signal needs to be emitted?
Is there a list of the signals somewhere?
Hi, Anisha.
You can provide you own signal and appropriate slot for it.
For example
Code:
{ Q_OBJECT public: signals: //you can emmit this signal, with button's id when appropriate button of joystik is pressed void evButtonPressed(int button_id); //-------- other methods and members of class ----- }; { Q_OBJECT public: public slots: // connect this slot to CJoistikReader::evButtonPressed(int) signal and process pressing void processPressingButton(int button_id); //-------- other methods and members of class ----- };
In QtGui model (though QApplication eventLoop) EVENTs (not signals) sending during about keyboadr and mouse manipulating (EKeyPressEvent, EMousePressEvent and so on). See QWidget documentation.
For each QObject class in Qt the signals are listed in the API, but you can always define as much custom signals as you want. Who is the receiver object of you signal? What should happen after the button press?