Indicating/catching signals
Hello!
I've got in my header file signal:
Code:
signals:
void mySignal(int i);
Sometimes mySignal(int i) is emitted by different slots:
Code:
connect(pushButton, SIGNAL(clicked()), this, SLOT(myFunc));
[...]
void MainWindow::myFunc()
{
mySignal(10);
}
How can I catch that signal?
thanks in advance
best regards
Tomasz
Re: Indicating/catching signals
Re: Indicating/catching signals
Would it be wrong if I do it that way:
Code:
connect(pushButton, SIGNAL(clicked()), this, SLOT(myFunc()));
connect(this, SIGNAL(mySignal(int), this, SLOT(myOtherFunc(int)));
[...]
void MainWindow::myFunc()
{
mySignal(10);
}
I've tried this, and it works, but I don't know if it's correct use of signals.
thanks in advance
best regards
Tomasz
Re: Indicating/catching signals
Sure, there's no problem with that.
Re: Indicating/catching signals
Quote:
Originally Posted by
tbscope
But 'emit' is only syntactic suger. You can omit and save the keystrokes at the expense of code readability.
Re: Indicating/catching signals
Quote:
Originally Posted by
squidge
But 'emit' is only syntactic suger. You can omit and save the keystrokes at the expense of code readability.
I honnestly didn't know that.