Provides tool tips (balloon help) for any widget that usually shows up when a mouse is hovered over a widget for a set amount of time.
More...
|
| | QCustomTooltip (const StringView &text, const QPointF &pos, QWidget *parent=nullptr) |
| | Constructs a tooltip with the given text at the specified screen position.
|
| bool | eventFilter (QObject *, QEvent *) override |
| | Filters events to detect mouse movement and other events that should hide or reposition the tooltip.
|
|
void | hideTip () |
| | Hides the tooltip after a short delay.
|
| void | hideTipImmediately (int animation_duration=-1) |
| | Hides the tooltip immediately with an optional fade-out animation.
|
| int | margin () const |
| | Returns the margin around the tooltip text content.
|
| void | reuseTip (const StringView &text, const QPointF &pos) |
| | Reuses the existing tooltip instance with new text and position.
|
| void | setTargetOffset (QPoint target_offset) |
| | Sets an offset from the target position for tooltip placement.
|
| void | setTipRect (const QWidget *w, const QRect &r) |
| | Sets the widget and rectangle region that the tooltip is associated with.
|
| QSize | sizeHint () const override |
| | Returns the recommended size for the tooltip.
|
| bool | tipChanged (const QPointF &pos, const QString &text, QObject *o) |
| | Checks whether the tooltip content or position has changed.
|
| void | updateSize (const QPointF &pos) |
| | Updates the tooltip size and position based on the new screen position.
|
|
| static void | hide (int animation_duration=-1) |
| | Hides the currently showing tooltip with an optional fade-out animation.
|
| static bool | IsShowing () |
| | Checks whether a tooltip is currently being shown.
|
| static QCustomTooltip * | show (const StringView &text, const QPointF &pos, const QWidget *w, int animation_duration=-1) |
| | Shows a tooltip with the given text at the specified position near a widget.
|
|
| void | mouseMoveEvent (QMouseEvent *e) override |
| | Handles mouse move events to hide the tooltip when the mouse moves away.
|
| void | paintEvent (QPaintEvent *e) override |
| | Paints the tooltip with its custom appearance.
|
| void | resizeEvent (QResizeEvent *e) override |
| | Handles resize events to update the tooltip shape mask.
|
| void | timerEvent (QTimerEvent *e) override |
| | Handles timer events for auto-hiding the tooltip after a delay.
|
Provides tool tips (balloon help) for any widget that usually shows up when a mouse is hovered over a widget for a set amount of time.
Definition at line 47 of file QCustomTooltip.h.
◆ QCustomTooltip()
| QCustomTooltip::QCustomTooltip |
( |
const StringView & | text, |
|
|
const QPointF & | pos, |
|
|
QWidget * | parent = nullptr ) |
Constructs a tooltip with the given text at the specified screen position.
- Parameters
-
| [in] | text | The tooltip text to display. |
| [in] | pos | The screen position where the tooltip should appear. |
| [in] | parent | The parent widget, or nullptr for no parent. |
References QCustomTooltip().
Referenced by QCustomTooltip(), and show().
◆ eventFilter()
| bool QCustomTooltip::eventFilter |
( |
QObject * | , |
|
|
QEvent * | ) |
|
override |
Filters events to detect mouse movement and other events that should hide or reposition the tooltip.
- Parameters
-
| [in] | object | The object that generated the event. |
| [in] | event | The event to filter. |
- Returns
- True if the event was handled, false otherwise.
◆ hide()
| void QCustomTooltip::hide |
( |
int | animation_duration = -1 | ) |
|
|
static |
Hides the currently showing tooltip with an optional fade-out animation.
- Parameters
-
| [in] | animation_duration | The fade-out duration in milliseconds, or -1 for default. |
◆ hideTipImmediately()
| void QCustomTooltip::hideTipImmediately |
( |
int | animation_duration = -1 | ) |
|
Hides the tooltip immediately with an optional fade-out animation.
- Parameters
-
| [in] | animation_duration | The fade-out duration in milliseconds, or -1 for default. |
◆ IsShowing()
| bool QCustomTooltip::IsShowing |
( |
| ) |
|
|
static |
Checks whether a tooltip is currently being shown.
- Returns
- True if a tooltip is visible, false otherwise.
◆ margin()
| int QCustomTooltip::margin |
( |
| ) |
const |
Returns the margin around the tooltip text content.
- Returns
- The margin in pixels.
◆ mouseMoveEvent()
| void QCustomTooltip::mouseMoveEvent |
( |
QMouseEvent * | e | ) |
|
|
overrideprotected |
Handles mouse move events to hide the tooltip when the mouse moves away.
- Parameters
-
| [in] | e | The mouse move event. |
◆ paintEvent()
| void QCustomTooltip::paintEvent |
( |
QPaintEvent * | e | ) |
|
|
overrideprotected |
Paints the tooltip with its custom appearance.
- Parameters
-
◆ resizeEvent()
| void QCustomTooltip::resizeEvent |
( |
QResizeEvent * | e | ) |
|
|
overrideprotected |
Handles resize events to update the tooltip shape mask.
- Parameters
-
◆ reuseTip()
| void QCustomTooltip::reuseTip |
( |
const StringView & | text, |
|
|
const QPointF & | pos ) |
Reuses the existing tooltip instance with new text and position.
- Parameters
-
| [in] | text | The new tooltip text to display. |
| [in] | pos | The new screen position for the tooltip. |
◆ setTargetOffset()
| void QCustomTooltip::setTargetOffset |
( |
QPoint | target_offset | ) |
|
Sets an offset from the target position for tooltip placement.
- Parameters
-
| [in] | target_offset | The pixel offset to apply. |
◆ setTipRect()
| void QCustomTooltip::setTipRect |
( |
const QWidget * | w, |
|
|
const QRect & | r ) |
Sets the widget and rectangle region that the tooltip is associated with.
The tooltip will hide when the mouse leaves this region.
- Parameters
-
| [in] | w | The widget the tooltip is associated with. |
| [in] | r | The rectangular region within the widget. |
◆ show()
| QCustomTooltip * QCustomTooltip::show |
( |
const StringView & | text, |
|
|
const QPointF & | pos, |
|
|
const QWidget * | w, |
|
|
int | animation_duration = -1 ) |
|
static |
Shows a tooltip with the given text at the specified position near a widget.
- Parameters
-
| [in] | text | The tooltip text to display. |
| [in] | pos | The screen position where the tooltip should appear. |
| [in] | w | The widget the tooltip is associated with. |
| [in] | animation_duration | The fade-in duration in milliseconds, or -1 for default. |
- Returns
- A pointer to the tooltip instance.
References QCustomTooltip().
◆ sizeHint()
| QSize QCustomTooltip::sizeHint |
( |
| ) |
const |
|
override |
Returns the recommended size for the tooltip.
- Returns
- The recommended QSize for layout calculations.
◆ timerEvent()
| void QCustomTooltip::timerEvent |
( |
QTimerEvent * | e | ) |
|
|
overrideprotected |
Handles timer events for auto-hiding the tooltip after a delay.
- Parameters
-
◆ tipChanged()
| bool QCustomTooltip::tipChanged |
( |
const QPointF & | pos, |
|
|
const QString & | text, |
|
|
QObject * | o ) |
Checks whether the tooltip content or position has changed.
- Parameters
-
| [in] | pos | The new position to compare. |
| [in] | text | The new text to compare. |
| [in] | o | The new associated object to compare. |
- Returns
- True if any parameter has changed, false otherwise.
◆ updateSize()
| void QCustomTooltip::updateSize |
( |
const QPointF & | pos | ) |
|
Updates the tooltip size and position based on the new screen position.
- Parameters
-
| [in] | pos | The new screen position. |
The documentation for this class was generated from the following file: