Qt Signals and Slots, Connecting and Disconnecting
Slots, slots everywhere... by Ramon Talavera Qt connects widgets by means of a nice designed scheme based on the idea that objectS may send signalS of different typeS to a single object instance: This is a screenshot of the example code running. The main application creates dialogs A and B and then connects the signal from A to the signal slot in B. I cannot believe I have clicked it 100 times to show you that it works... Declaring the signal: A declares to be able to send signals of type ' somebodyClicked ': class ObjectADialog : public QDialog { Q_OBJECT public: explicit ObjectADialog(QWidget *parent = 0); ~ObjectADialog(); signals: void somebodyClicked(QString who); protected: void closeEvent(QCloseEvent *event); private slots: void on_pushButton_clicked(); private: Ui::ObjectADialog *ui; }; Declaring the slot: B declares to contain a slot method for signals to connect to: class ObjectBDialog ...