How to remove the time delay before a QToolTip is

2020-01-31 07:10发布

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?

标签: qt tooltip
1条回答
beautiful°
2楼-- · 2020-01-31 07:36

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*).

查看更多
登录 后发表回答