Understanding signal slot flow
-
Hi,
This is just to improve my understanding of how Qt/Signals and SLots work.I have 1 Main Window MW, 1 Child window CW and 1 Child class CC.
Case 1
I emit signal in child class, connect CC signal to CW slot. Nothing happens. I set up the connection in the constructor for MW where I create CC and CW.
workaround solution, Case 2
I then emit signal in CC, connect CC signal to MW slot, call the CW functions from MW slot, everything works perfectly!Why does case 1 fail?
Thanks,
kpks -
check the return value of the connect() statement. In case of an error it returns false.
Also check the console since any problems with the signal-slot-connection are printed there and give a fast hint what is going wrong.I suspect you use a NULL pointer at the time you setup the connection.
-
I check the status and print a "connection made" if true, that works fine.
There is nothing in the console, just this in issues:
D:\kpks\software\tcpComm\dynamicplots.ui:-1: warning: Z-order assignment: 'plotW' is not a valid widget. -
Do all of Your classes derive from QObject and contain Q_OBJECT macro?
Robert