Program hangs when i emit a global variable (Solved)
A qt statement connect Slot and Signals together. Like to understand how variable qint8
is pass from Signals functions to Slot functions.
extern qint8 myvalue; //in slots cpp
connect(UdpReceived, SIGNAL(TriggerReceived(qint8)), this, SLOT(TriggerSlot(qint8))) //constructor
void TriggerReceived(qint8 myvalue); //declaration, in signals .h
qint8 myvalue //global value
emit TriggerReceived( myvalue); //definition, in signals .cpp
qint8 myvalue; //signals .h
i understand moc(meta object compiler) connects them together but how is varaible pass?
The reason is because i declare variable-myvalue as global instead as class public variable.
The program hangs either i emits this global or public variable
Please enlighten me.
Could pass variable through connecting two objects but could not pass variables using extern. Why ??
connect(UdpReceived, SIGNAL(TriggerReceived(qint8)), this, SLOT(TriggerSlot(qint8)))
I could not pass variables using extern
extern qint8 m_valuetopass
connect(UdpReceived, SIGNAL(TriggerReceived()), this, SLOT(TriggerSlot()))
signal has no implementation, but "emit TriggerReceived( myvalue)" is not declaration, either.
Thanks, Initially i did not emit a signal with parameter by value. I use a global value to pass between 2 cpp files.