comparison libgui/graphics/Figure.cc @ 33376:a8ce25c80695 stable

Correctly scale figure position on screen with DPI scaling. * libgui/graphics/Figure.cc (Figure::Figure): Set device pixel ratio (> 1 for high DPI screens) early on in constructor of Figure. * libinterp/corefcn/graphics.cc (figure::properties::get_boundingbox, figure::properties::bbox2position): Respect device pixel ratio in conversion of "position" property to Qt screen pixel coordinates. See: https://octave.discourse.group/t/5466
author Markus Mützel <markus.muetzel@gmx.de>
date Sat, 06 Apr 2024 14:43:10 +0200
parents 2e484f9f1f18
children d7e4a4e1a8fb
comparison
equal deleted inserted replaced
33366:31225b5d494d 33376:a8ce25c80695
128 connect (m_container, QOverload<const octave::meth_callback&>::of (&Container::interpreter_event), 128 connect (m_container, QOverload<const octave::meth_callback&>::of (&Container::interpreter_event),
129 this, QOverload<const octave::meth_callback&>::of (&Figure::interpreter_event)); 129 this, QOverload<const octave::meth_callback&>::of (&Figure::interpreter_event));
130 130
131 figure::properties& fp = properties<figure> (); 131 figure::properties& fp = properties<figure> ();
132 132
133 fp.set___device_pixel_ratio__ (win->devicePixelRatio ());
134
133 // Adjust figure position 135 // Adjust figure position
134 m_innerRect = boundingBoxToRect (fp.get_boundingbox (true)); 136 m_innerRect = boundingBoxToRect (fp.get_boundingbox (true));
135 m_outerRect = boundingBoxToRect (fp.get_boundingbox (false)); 137 m_outerRect = boundingBoxToRect (fp.get_boundingbox (false));
136 138
137 set_geometry (m_innerRect); 139 set_geometry (m_innerRect);