Commit 0189588e authored by Cory Quammen's avatar Cory Quammen

Fix Hover {Points|Cells} tooltip on HiDPI displays

Now we take the device pixel ratio into account when placing the
tooltip. This fixes positioning of the tooltips in Hover Points
and Hover Cells mode on systems with HiDPI displays.

Prior to this change, the tooltips were positioned 2x as far away from
the lower left corner as the actual selected point or cell.
parent da202619
......@@ -588,9 +588,14 @@ void pqRenderViewSelectionReaction::UpdateTooltip()
pipeline->GetTooltipInfo(association, tooltipPos, tooltipText))
QWidget* widget = this->View->widget();
// Take DPI scaling into account for the transformation
qreal dpr = widget->devicePixelRatioF();
// Convert renderer based position to a global position
QPoint pos =
widget->mapToGlobal(QPoint(tooltipPos[0], widget->size().height() - tooltipPos[1]));
QPoint pos = widget->mapToGlobal(
QPoint(tooltipPos[0] / dpr, widget->size().height() - (tooltipPos[1] / dpr)));
QToolTip::showText(pos, tooltipText.c_str());
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment