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

Discussions about all things Bitcraze
Post Reply
cafeciaojoe
Member
Posts: 83
Joined: Mon Jun 18, 2018 2:37 am

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

Post 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
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
kristoffer
Bitcraze
Posts: 630
Joined: Tue Jun 30, 2015 7:47 am

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

Post 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)
cafeciaojoe
Member
Posts: 83
Joined: Mon Jun 18, 2018 2:37 am

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

Post by cafeciaojoe »

Thanks! this was a good start. We made a work around from here.
PhD Student
RMIT University
School of Design
http://www.cafeciaojoe.com
Image
Post Reply