PyQt5 – Access tooltip duration to view(drop-down) of ComboBox
In this article we will see how we can access the tool tip duration oo 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 duration 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 tool tip duration to the view object
6. Get the tool tip duration of the view object and store it in a variable
7. Create a label to show the duration
# getting view part of combo box view = self.combo_box.view() # setting tool tip to view object of the combo box view.setToolTip(tip) # setting tool tip duration to view object view.setToolTipDuration(2000) # accessing tool tip duration duration = view.toolTipDuration()
Below is the implementation