probine
31st March 2006, 00:13
Class A has a QPushButton. Class B has a Slot called conectToServer().
Class A has to send an string called name, when the button is pressed to the Slot in class B.
Class A:
string name = "hi";
connect(btnLogin, SIGNAL(clicked()), classB, SLOT(connectToServer(name)));
Class B:
public slots:
void connectToServer(string);
When I use the same code, but I do not send any arguments in the call to connectToServer(), then everything is fine. Sending the string is not possible.
I read the docs and it says that a SLOT is like an ordinary C++ function, so it should be able to accept arguments.
Am I doing something wrong ?
Class A has to send an string called name, when the button is pressed to the Slot in class B.
Class A:
string name = "hi";
connect(btnLogin, SIGNAL(clicked()), classB, SLOT(connectToServer(name)));
Class B:
public slots:
void connectToServer(string);
When I use the same code, but I do not send any arguments in the call to connectToServer(), then everything is fine. Sending the string is not possible.
I read the docs and it says that a SLOT is like an ordinary C++ function, so it should be able to accept arguments.
Am I doing something wrong ?