So I have in my main function:
string s = "\nWelcome to Rawr\n";
const QString output(s);
**emit output(output); <<<<<<<<<<<<<<<<<<&l开发者_开发技巧t;<<<<<<<<<<<< Getting an error here**
I have set up a Signal in QT Desginer named: output(const QString &s)
My receiver for the signal is my "Form"... in my form.h i have: The slot is called "changeOutput(const QString &s).
void Client::changeOutput(const QString &s)
{
output_box.setText(s);
}
output_box is a QTextEdit box.
The error I am receiving is : TCPClient.cpp:122: error: no match for call to ‘(const QString) (const QString&)’
What am I doing wrong?
Thanks :)
Since you declared a variable output
, the name output
refers to that variable in the local scope. The compiler doesn't know that in output(output)
you want one output
to refer to the variable and the other output
to refer to the slot/method.
Use a different name for the local variable to avoid this collision.
精彩评论