Signals and Slot Problem
-
in socketudp.cpp
ipDataReceived(datagram) is emittedIn main.cpp
socketudp UnderUDP;
UnderUDP object created.
If i create object in mainwindow.cpp, UDP data cannot received (TCP no problem)
(strange problem, i tried debugging many times and this is the symptom.in mainwindow.cpp
connect(&UnderUDP,SIGNAL(ipDataReceived(QByteArray)),this,SLOT(onPortDataReceived(QByteArray)));doing debug, i found my SLOT is never call. Why is this so?
I did experiment 2.
I move slot and QObject::connect to main.cpp but can't declare slot in main.cpp. Pls Help ..
I am out of idea. -
Hi,
Without any code it's pretty much Crystal Ball (™).
IRCC, debugging, so can you share it ?
-
I found that i can make connection for UDP to my system not in Mainwindow but in main (before mainwindow object is created), but my problem is main do not have header file ( there is no main.h only main.cpp).
Thus i can't add a SLOT in main.h.
-
Depends, you can use C++11 lambda as slots