diff libgui/graphics/Canvas.h @ 20305:062422f2e399

Show axes coordinates in Qt figures (bug #44959) * Canvas.h: new private bool member m_updtaCurrentPoint, to decide wether update the figure "currentpoint" property * Canvas.h (Canvas::enableCurrentPointUpdates): new method to set m_updtaCurrentPoint * Canvas.cc (Canvas::canvasMousePressEvent): move the code for axes/object selection in a dedicated method and call this method (select_object) instead. * Canvas.cc (Canvas::select_object): new method for axes/object selection. * Canvas.cc (Canvas::canvasMouseMoveEvent): update the parent figure status bar with the hovered axes coordinates * Figure.h: declare new method updateStatusBar * Figure.h: declare new private QStatusBar member m_statusBar. Include QStatusBar.h * Figure.cc (Figure::Figure): unconditionally enable mouse traching * Figure.cc (Figure::Figure): add status below of the canvas * Figure.cc (Figure::update): take status bar into account when updating the figure position * Figure.cc (Figure::update): remove some of the leftover debug comments * Figure.cc: define new method updateStatusBar
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sat, 13 Jun 2015 13:27:01 +0200
parents 248f2f2e7d48
children 2d415c68213f
line wrap: on
line diff
--- a/libgui/graphics/Canvas.h	Sat Jun 20 16:00:50 2015 -0700
+++ b/libgui/graphics/Canvas.h	Sat Jun 13 13:27:01 2015 +0200
@@ -70,6 +70,7 @@
   virtual void toggleAxes (const graphics_handle& handle) = 0;
   virtual void toggleGrid (const graphics_handle& handle) = 0;
   virtual void autoAxes (const graphics_handle& handle) = 0;
+  void enableCurrentPointUpdates (bool on) { m_updateCurrentPoint = on; }
 
 protected:
   virtual void draw (const graphics_handle& handle) = 0;
@@ -85,7 +86,8 @@
       m_mouseMode (NoMode),
       m_clickMode (false),
       m_eventMask (0),
-      m_rectMode (false)
+      m_rectMode (false),
+      m_updateCurrentPoint (false)
     { }
 
   void canvasToggleAxes (const graphics_handle& handle);
@@ -106,6 +108,8 @@
                            const graphics_object& obj);
 
   void annotation_callback (const octave_value_list& args);
+  void select_object (graphics_object obj, QMouseEvent* event, 
+                      graphics_object &currentObj, graphics_object &axesObj);
 
 private:
   graphics_handle m_handle;
@@ -117,6 +121,7 @@
   graphics_handle m_mouseAxes;
   int m_eventMask;
   bool m_rectMode;
+  bool m_updateCurrentPoint;
 };
 
 }; // namespace QtHandles