In this article we will see how we can access the tool tip of the drop down part of the combo box. When we set tool tip to the combo box it only shows for the line edit part, tool tip is not visible for the drop down part i.e its view part.
In order to access tool tip to the view part, do the following steps for implementation –
1. Create Combo box
2. Add items to the combo box
3. Get the view object of the combo box
4. Add tool tip to the view object
5. Get the tool tip of the view object and store it in a variable
6. Create a label to show the tool tip
# getting view part of combo box view = self.combo_box.view() # setting tool tip to view object of the combo box view.setToolTip(tip) # accessing tool tip get_tip = view.toolTip()
Below is the implementation –
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.