Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to remove the time delay before a QToolTip is displayed?

Tags:

tooltip

qt

I have a custom QGraphicsItem with a QToolTip. When hovering with the mouse on them the tool tip shows fine, but there is a small delay before the tool tip shows.

How can I decrease that delay, so the tool tip will show immediately?

like image 487
GoldenAxe Avatar asked Dec 05 '12 09:12

GoldenAxe


1 Answers

In the documentation for QWidget::mouseMoveEvent(QMouseEvent*) you can read the following description:

If you want to show a tooltip immediately, while the mouse is moving (e.g., to get the mouse coordinates with QMouseEvent::pos() and show them as a tooltip), you must first enable mouse tracking as described above. Then, to ensure that the tooltip is updated immediately, you must call QToolTip::showText() instead of setToolTip() in your implementation of mouseMoveEvent().

But instead of using the mouseMoveEvent, you could also use the QWidget::enterEvent(QEvent*).

like image 161
mfreiholz Avatar answered Nov 03 '22 09:11

mfreiholz