A question about the signal slot

This is a white problem.

Today encounter a problem when doing pass values ​​between form: connect returns true, but the slot can not receive signals.

After inspection found the problem: connect the (signal) object must be an object and transmitting signals is the same.

As, in the constructor of mainwindow:

 QObject::connect(pDlgSerial, SIGNAL(ChangeSerialInfo(QString)), this, SLOT(UpdateSerialInfo(QString)));
ChangeSerialInfo signal is another dialog box, UpdateSerialInfo is the slot function. 
Then, if I need it for other functions in mainwindow display the dialog box, I have to pDlgSerial declared as member variables of mainwindow. If you declare an object constructor, another function can also declare an object, it will appear the above mentioned problems, connect returns true, but not receiving a signal.
This is a white problem.

Guess you like

Origin www.cnblogs.com/warmlight/p/10986322.html