PyQt5 QSpinBox – Getting previous widget in focus chain
In this article we will see how we can get the widget which is previous in focus chain of the spin box. Spin box consist of two child widgets one is line edit and other one is the arrow buttons. Focus is set widget by widget i.e focus chain therefore when spin box get focus its one child get focus before the another child similarly before spin box, main window comes in focus chain.
In order to do this we use
previousInFocusChain method with the spin box object.
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course. And to begin with your Machine Learning Journey, join the Machine Learning - Basic Level Course
Syntax : spin_box.previousInFocusChain()
Argument : It takes no argument
Return : It returns QWidget object
Below is the implementation