Neuralyzer::Plots::PlotTooltipManager
Neuralyzer::Plots::PlotTooltipManager
Manages tooltip lifecycle for plot widgets. More…
#include <PlotTooltipManager.hpp>
Inherits from QObject
Public Classes
| Name | |
|---|---|
| class | PixmapPopup |
Public Functions
| Name | |
|---|---|
| PlotTooltipManager(QWidget * parent_widget, int dwell_ms =500) Construct a tooltip manager. |
|
| ~PlotTooltipManager() override | |
| PlotTooltipManager(PlotTooltipManager const & ) =delete | |
| PlotTooltipManager & | operator=(PlotTooltipManager const & ) =delete |
| PlotTooltipManager(PlotTooltipManager && ) =delete | |
| PlotTooltipManager & | operator=(PlotTooltipManager && ) =delete |
| void | setHitTestProvider(TooltipHitTestFn provider) Set the hit-test callback. |
| void | setTextProvider(TooltipTextFn provider) Set a simple text content provider. |
| void | setContentProvider(TooltipContentFn provider) Set the full content provider (supports text and pixmap). |
| void | setDwellTime(int ms) Set the dwell time before showing the tooltip. |
| void | setEnabled(bool enabled) Enable or disable tooltips entirely. |
| bool | isEnabled() const Check whether tooltips are enabled. |
| void | onMouseMove(QPoint screen_pos, bool is_interacting) Notify the manager of a mouse move. |
| void | onLeave() Notify the manager that the mouse left the widget. |
| void | hide() Hide the tooltip immediately. |
Detailed Description
class Neuralyzer::Plots::PlotTooltipManager;Manages tooltip lifecycle for plot widgets.
Owns a single-shot QTimer. On each mouse move the timer is restarted. When the timer fires (mouse is “stationary”), the hit-test provider is called. If a hit is found, the content provider generates the tooltip content, which is then displayed.
The manager must be told about panning state so that tooltips are suppressed during drag operations.
Public Functions Documentation
function PlotTooltipManager
explicit PlotTooltipManager(
QWidget * parent_widget,
int dwell_ms =500
)Construct a tooltip manager.
Parameters:
- parent_widget The QWidget that owns this manager and anchors the tooltip position
- dwell_ms Dwell time in milliseconds before showing the tooltip (default 500)
function ~PlotTooltipManager
~PlotTooltipManager() overridefunction PlotTooltipManager
PlotTooltipManager(
PlotTooltipManager const &
) =deletefunction operator=
PlotTooltipManager & operator=(
PlotTooltipManager const &
) =deletefunction PlotTooltipManager
PlotTooltipManager(
PlotTooltipManager &&
) =deletefunction operator=
PlotTooltipManager & operator=(
PlotTooltipManager &&
) =deletefunction setHitTestProvider
void setHitTestProvider(
TooltipHitTestFn provider
)Set the hit-test callback.
This function is called when the dwell timer fires to determine whether anything is under the cursor. It should perform spatial queries (QuadTree, kd-tree, etc.) and return a hit result.
function setTextProvider
void setTextProvider(
TooltipTextFn provider
)Set a simple text content provider.
Convenience overload for widgets that only need plain-text tooltips. Internally wraps the text in a PlotTooltipContent.
function setContentProvider
void setContentProvider(
TooltipContentFn provider
)Set the full content provider (supports text and pixmap).
Use this when the tooltip may contain rendered images (glyphs, mini-plots, etc.).
function setDwellTime
void setDwellTime(
int ms
)Set the dwell time before showing the tooltip.
Parameters:
- ms Dwell time in milliseconds
function setEnabled
void setEnabled(
bool enabled
)Enable or disable tooltips entirely.
function isEnabled
bool isEnabled() constCheck whether tooltips are enabled.
function onMouseMove
void onMouseMove(
QPoint screen_pos,
bool is_interacting
)Notify the manager of a mouse move.
Parameters:
- screen_pos Current screen-space cursor position
- is_interacting True if the widget is currently panning/dragging
Call this from the widget’s mouseMoveEvent(). The manager restarts the dwell timer at the new position. If is_interacting is true (e.g. panning or drawing), the timer is suppressed.
function onLeave
void onLeave()Notify the manager that the mouse left the widget.
Stops the timer and hides any visible tooltip. Call this from leaveEvent().
function hide
void hide()Hide the tooltip immediately.
Useful when the scene changes (rebuild) or the widget starts an interaction that should dismiss the tooltip.
Updated on 2026-11-13 at 20:25:41 +0000