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))) //constructorsignals:
void TriggerReceived(qint8 myvalue); //declaration, in signals .hqint8 myvalue //global value
emit TriggerReceived( myvalue); //definition, in signals .cppOr =====
public:
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 variablePlease 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_valuetopassconnect(UdpReceived, SIGNAL(TriggerReceived()), this, SLOT(TriggerSlot()))
@signal has no implementation, but "emit TriggerReceived( myvalue)" is not declaration, either.