PyQt5 – Access tooltip of view(drop-down) of ComboBox
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 –
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
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 –