Page 1 of 1

PyQt question: Connect the X button to a function in a Tab

Posted: Thu Apr 29, 2021 12:41 am
by cafeciaojoe
I have a tab in the client that listens for data from a socket.
When I close the client I cant get the Tab to shut down the socket.
I have tried a number of ways to trigger a function on close but failing.
Here is the closest example on stack overflow I can find.
https://stackoverflow.com/questions/403 ... qtabwidget

I was hoping somoene with intimate knowledge of the front end of the client can help me.

Cheers
Joe

Re: PyQt question: Connect the X button to a function in a Tab

Posted: Thu Apr 29, 2021 3:24 pm
by kristoffer
Qt is not my strongest topic but you could try to do something from
https://github.com/bitcraze/crazyflie-c ... #L577-L580
This function is called when the client is closed.

The suggested solution in StackOverflow looks like a better solution since everything will be encapsulated in your tab class. (I could not get it to work when I did a quick test though, but I might have messed something up)

Re: PyQt question: Connect the X button to a function in a Tab

Posted: Mon May 10, 2021 7:48 am
by cafeciaojoe
Thanks! this was a good start. We made a work around from here.