[Solved] setToolTip(QString()) leaves previous tooltip visible
-
I have a widget where the tooltip dynamically changes, depending on the mouse cursor position. Within the mouseMoveEvent, I check whether the cursor is in one of several pre-defined areas, and set the tooltip accordingly.
This part works just fine.
However, in some cases I do not want to show any tooltip at all. In this case, I call
@setToolTip(QString());@
When I move the mouse cursor from an area with tooltip to one without, the last tooltip remains, although I no longer have any tooltip defined.
Why does calling setToolTip without any string not hide the tooltip? Is there any way I can manually hide the tooltip?
-
Could you show us the part of your code that does the tooltip appear?
You could do this?
@if(myCursor.selectedText() == "Hello!") {
QToolTip::showText([...]);
} else {
QTooltip::hideText();
}@ -
I do not use QTooltip. I simply subclassed from QLabel, and use setTooltip to change the text that should be displayed.
-
Sorry, I misunderstood your posting at first.
Manually calling QTooltip::hideText() does what I need.
Thanks!