##// END OF EJS Templates
Shifts tooltip to mouse
Alexandre Leroux -
r543:4cbf5bf3dd44
parent child
Show More
@@ -9,6 +9,9 const auto DATETIME_FORMAT = QStringLiteral("yyyy/MM/dd hh:mm:ss:zzz");
9 9
10 10 const auto TOOLTIP_FORMAT = QStringLiteral("key: %1\nvalue: %2");
11 11
12 /// Offset used to shift the tooltip of the mouse
13 const auto TOOLTIP_OFFSET = QPoint{20, 20};
14
12 15 /// Tooltip display rectangle (the tooltip is hidden when the mouse leaves this rectangle)
13 16 const auto TOOLTIP_RECT = QRect{10, 10, 10, 10};
14 17
@@ -91,8 +94,8 void VisualizationGraphRenderingDelegate::onMouseMove(QMouseEvent *event) noexce
91 94 // Starts timer to show tooltip after timeout
92 95 auto showTooltip = [ tooltip = TOOLTIP_FORMAT.arg(key, value), eventPos, this ]()
93 96 {
94 QToolTip::showText(impl->m_Plot.mapToGlobal(eventPos), tooltip, &impl->m_Plot,
95 TOOLTIP_RECT);
97 QToolTip::showText(impl->m_Plot.mapToGlobal(eventPos) + TOOLTIP_OFFSET, tooltip,
98 &impl->m_Plot, TOOLTIP_RECT);
96 99 };
97 100
98 101 QObject::connect(&impl->m_TracerTimer, &QTimer::timeout, showTooltip);
General Comments 0
You need to be logged in to leave comments. Login now