views:

63

answers:

1

So I have in my main function:

string s = "\nWelcome to Rawr\n";
const QString output(s);
**emit output(output);       <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< 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 :)

+2  A: 

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.

sth
Thank you so much ^_____^
NeverAgain