In this article we will see how we can get the tooltip duration of the label part of scroll label, when know we can make scrollable label with the help of inheriting a scroll class and making label in it, but when we set tooltip to the class object tooltip is set to the whole widget i.e label and the scroll bar as well.
In order to get tooltip and its duration of the label part, we have to override the function of the object.
Steps for implementation –
1. Create a new class which inherits QScrollArea
2. Inside the class create vertical layout
3. Create a label and make it multi-line and add it to the layout
5. Over-ride the setText and text method for label
6. Over-ride setToolTip and setToolTipDuration method
7. Over-ride toolTipDuration method which return duration of label tool tip
8. Create object of this class inside the main window class and setting text to it
9. Add tooltip and its duration to the object with the help of
10. Get the tooltip with the help of toolTipDuration method
11. Create another label to show the duration
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.