Mercurial > octave
changeset 32390:811e8088f0cd
gui: Replace QMouseEvent::localPos() by QMouseEvent::position() for Qt6.
* libgui/graphics/Canvas.cc (Canvas::select_object):
For Qt6, replace usage of deprecated QMouseEvent::localPos () by
QMouseEvent::position ().
author | Markus Mützel <markus.muetzel@gmx.de> |
---|---|
date | Sun, 08 Oct 2023 18:28:46 +0200 |
parents | e30bddd8ebaf |
children | 6ce32f4ca644 |
files | libgui/graphics/Canvas.cc |
diffstat | 1 files changed, 12 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc Sun Oct 08 15:40:09 2023 +0200 +++ b/libgui/graphics/Canvas.cc Sun Oct 08 18:28:46 2023 +0200 @@ -373,7 +373,12 @@ r.adjust (-5, -5, 5, 5); - bool rect_contains_pos = r.contains (event->localPos ()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPointF mouse_pos = event->position (); +#else + QPointF mouse_pos = event->localPos (); +#endif + bool rect_contains_pos = r.contains (mouse_pos); if (rect_contains_pos) { currentObj = childObj; @@ -427,7 +432,12 @@ // the axes and still select it. r.adjust (-20, -20, 20, 20); - bool rect_contains_pos = r.contains (event->localPos ()); +#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) + QPointF mouse_pos = event->position (); +#else + QPointF mouse_pos = event->localPos (); +#endif + bool rect_contains_pos = r.contains (mouse_pos); if (rect_contains_pos) axesObj = *it; }