I have a QTabWidget, and two classes, display1 and display2, are two tab members. I want to transfer some data, say a bool flag, between these two tabs:
display1 = new Display1 ();
display2= new Display2()
tabWidget->addTab(display1 , tr("Online"));
tabWidget->addTab(display2, tr("Offline"));
connect(Display1, SIGNAL(sendout(bool)), Display2, SLOT(receive(bool)));
tabWidget = new QTabWidget;
display1 = new Display1 ();
display2= new Display2()
tabWidget->addTab(display1 , tr("Online"));
tabWidget->addTab(display2, tr("Offline"));
connect(Display1, SIGNAL(sendout(bool)), Display2, SLOT(receive(bool)));
To copy to clipboard, switch view to plain text mode
In class Display1.h:
signals:
void sendout(bool flag);
signals:
void sendout(bool flag);
To copy to clipboard, switch view to plain text mode
In class Display1.cpp, one of its methods does this:
bool flag = true;
emit sendout(flag);
bool flag = true;
emit sendout(flag);
To copy to clipboard, switch view to plain text mode
In class Display2.h:
public slots:
void receive(bool flag);
public slots:
void receive(bool flag);
To copy to clipboard, switch view to plain text mode
In class Display2.cpp:
void Display2::receive(bool flag)
{
printf("I got one message. \n");
}
void Display2::receive(bool flag)
{
printf("I got one message. \n");
}
To copy to clipboard, switch view to plain text mode
I got LINK ERROR:
Error 6 error LNK2001: unresolved external symbol "protected: void __thiscall Display1::sendout(bool)" (?sendout@Display1@@IAEX_N@Z) Display1.obj
I have no idea where is the problem....Can anyone help me? Thanks
Bookmarks