PDA

View Full Version : I need help for signals



avis_phoenix
10th February 2007, 16:34
Well i was created a QT Dialog and i need create a signal for this dialog, in such a way that when it does click in a button I warned that I did click to him (this outside of dialog).
Then i need a tutorial for create a signals to use in connect
Thanks

jpn
10th February 2007, 16:43
You could use "signal chaining" (connecting a signal to another signal) for achieving this. See the example below:


class MyDialog : public QDialog
{
// don't forget this macro whenever you declare
// custom signals and/or slots
Q_OBJECT

public:
MyDialog(QWidget* parent = 0);

// declare a custom signal
signals:
void someButtonClicked();
};

MyDialog::MyDialog(QWidget* parent) : QDialog(parent)
{
// form a connection between the button and the dialog
connect(someButtonInTheDialog, SIGNAL(clicked()), this, SIGNAL(someButtonClicked()));
}