changeset 32387:90abc5bf1f43

gui: Replace QMouseEvent::x() or y() by QMouseEvent::pos(). * libgui/graphics/Canvas.cc (Canvas::updateCurrentPoint, Canvas::canvasMouseMoveEvent, Canvas::canvasMouseReleaseEvent), libgui/qterminal/libqterminal/unix/TerminalView.cpp (TerminalView::mouseMoveEvent): Replace usage of deprecated QMouseEvent::x () and QMouseEvent::y () by QMouseEvent::pos () and QPoint::x () and QPoint::y ().
author Markus Mützel <markus.muetzel@gmx.de>
date Sun, 08 Oct 2023 14:57:20 +0200
parents c6394845cc2d
children 830f0a2508d5
files libgui/graphics/Canvas.cc libgui/qterminal/libqterminal/unix/TerminalView.cpp
diffstat 2 files changed, 35 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/libgui/graphics/Canvas.cc	Sun Oct 08 14:08:11 2023 +0200
+++ b/libgui/graphics/Canvas.cc	Sun Oct 08 14:57:20 2023 +0200
@@ -200,10 +200,13 @@
           Matrix x_zlim = ap.get_transform_zlim ();
           graphics_xform x_form = ap.get_transform ();
 
-          ColumnVector p1 = x_form.untransform (event->x (), event->y (),
-                                                x_zlim(0));
-          ColumnVector p2 = x_form.untransform (event->x (), event->y (),
-                                                x_zlim(1));
+          QPoint mouse_position = event->pos ();
+          ColumnVector p1
+            = x_form.untransform (mouse_position.x (), mouse_position.y (),
+                                  x_zlim(0));
+          ColumnVector p2
+            = x_form.untransform (mouse_position.x (), mouse_position.y (),
+                                  x_zlim(1));
 
           Matrix cp (2, 3, 0.0);
 
@@ -452,8 +455,9 @@
           {
             axes::properties& ap = Utils::properties<axes> (ax);
 
-            ap.rotate3d (m_mouseCurrent.x (), event->x (),
-                         m_mouseCurrent.y (), event->y ());
+            QPoint mouse_position = event->pos ();
+            ap.rotate3d (m_mouseCurrent.x (), mouse_position.x (),
+                         m_mouseCurrent.y (), mouse_position.y ());
 
             // Update current mouse position
             m_mouseCurrent = event->pos ();
@@ -479,8 +483,9 @@
 
             ColumnVector p0 = ap.pixel2coord (m_mouseCurrent.x (),
                                               m_mouseCurrent.y ());
-            ColumnVector p1 = ap.pixel2coord (event->x (),
-                                              event->y ());
+            QPoint mouse_position = event->pos ();
+            ColumnVector p1 = ap.pixel2coord (mouse_position.x (),
+                                              mouse_position.y ());
 
             ap.translate_view (mode, p0(0), p1(0), p0(1), p1(1));
 
@@ -532,7 +537,11 @@
           axes::properties& ap = Utils::properties<axes> (axesObj);
 
           if (fig)
-            fig->updateStatusBar (ap.pixel2coord (event->x (), event->y ()));
+            {
+              QPoint mouse_position = event->pos ();
+              fig->updateStatusBar (ap.pixel2coord (mouse_position.x (),
+                                                    mouse_position.y ()));
+            }
         }
     }
 }
@@ -805,11 +814,13 @@
 
           std::string zm = zoom_mode (figObj);
 
-          if (m_mouseAnchor == event->pos ())
+          QPoint mouse_position = event->pos ();
+          if (m_mouseAnchor == mouse_position)
             {
               double factor = (m_clickMode ? 2.0 : 0.5);
 
-              ColumnVector p1 = ap.pixel2coord (event->x (), event->y ());
+              ColumnVector p1 = ap.pixel2coord (mouse_position.x (),
+                                                mouse_position.y ());
 
               ap.zoom_about_point (zm, p1(0), p1(1), factor);
             }
@@ -817,8 +828,8 @@
             {
               ColumnVector p0 = ap.pixel2coord (m_mouseAnchor.x (),
                                                 m_mouseAnchor.y ());
-              ColumnVector p1 = ap.pixel2coord (event->x (),
-                                                event->y ());
+              ColumnVector p1 = ap.pixel2coord (mouse_position.x (),
+                                                mouse_position.y ());
 
               Matrix xl (1, 2, 0.0);
               Matrix yl (1, 2, 0.0);
@@ -860,11 +871,12 @@
           QWidget *w = qWidget ();
           if (w)
             {
+              QPoint mouse_position = event->pos ();
               Matrix bb = figObj.get ("position").matrix_value ();
               bb(0) = m_mouseAnchor.x () / bb(2);
               bb(1) = 1.0 - (m_mouseAnchor.y () / bb(3));
-              bb(2) = (event->x () - m_mouseAnchor.x ()) / bb(2);
-              bb(3) = (m_mouseAnchor.y () - event->y ()) / bb(3);
+              bb(2) = (mouse_position.x () - m_mouseAnchor.x ()) / bb(2);
+              bb(3) = (m_mouseAnchor.y () - mouse_position.y ()) / bb(3);
 
               octave_value_list props = ovl ("textbox", bb);
 
--- a/libgui/qterminal/libqterminal/unix/TerminalView.cpp	Sun Oct 08 14:08:11 2023 +0200
+++ b/libgui/qterminal/libqterminal/unix/TerminalView.cpp	Sun Oct 08 14:57:20 2023 +0200
@@ -1535,7 +1535,8 @@
   int charLine = 0;
   int charColumn = 0;
 
-  getCharacterPosition(ev->pos(),charLine,charColumn);
+  QPoint mouse_position = ev->pos ();
+  getCharacterPosition (mouse_position, charLine, charColumn);
 
   // handle filters
   // change link hot-spot appearance on mouse-over
@@ -1558,7 +1559,8 @@
       const QString& tooltip = spot->tooltip();
       if ( !tooltip.isEmpty() )
         {
-          QToolTip::showText( mapToGlobal(ev->pos()) , tooltip , this , _mouseOverHotspotArea );
+          QToolTip::showText (mapToGlobal (mouse_position), tooltip, this,
+                              _mouseOverHotspotArea );
         }
 
       update( _mouseOverHotspotArea | previousHotspotArea );
@@ -1602,8 +1604,10 @@
       // if the mouse has moved sufficiently, we will confirm
 
       int distance = 10; //KGlobalSettings::dndEventDelay();
-      if ( ev->x() > dragInfo.start.x() + distance || ev->x() < dragInfo.start.x() - distance ||
-           ev->y() > dragInfo.start.y() + distance || ev->y() < dragInfo.start.y() - distance)
+      if (mouse_position.x () > dragInfo.start.x () + distance
+          || mouse_position.x () < dragInfo.start.x () - distance
+          || mouse_position.y () > dragInfo.start.y () + distance
+          || mouse_position.y () < dragInfo.start.y () - distance)
         {
           // we've left the drag square, we can start a real drag operation now
           emit isBusySelecting(false); // Ok.. we can breath again.