Mercurial > octave-nkf
comparison 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 |
comparison
equal
deleted
inserted
replaced
20302:ce8fda51d236 | 20305:062422f2e399 |
---|---|
68 const graphics_handle& handle); | 68 const graphics_handle& handle); |
69 | 69 |
70 virtual void toggleAxes (const graphics_handle& handle) = 0; | 70 virtual void toggleAxes (const graphics_handle& handle) = 0; |
71 virtual void toggleGrid (const graphics_handle& handle) = 0; | 71 virtual void toggleGrid (const graphics_handle& handle) = 0; |
72 virtual void autoAxes (const graphics_handle& handle) = 0; | 72 virtual void autoAxes (const graphics_handle& handle) = 0; |
73 void enableCurrentPointUpdates (bool on) { m_updateCurrentPoint = on; } | |
73 | 74 |
74 protected: | 75 protected: |
75 virtual void draw (const graphics_handle& handle) = 0; | 76 virtual void draw (const graphics_handle& handle) = 0; |
76 virtual void drawZoomBox (const QPoint& p1, const QPoint& p2) = 0; | 77 virtual void drawZoomBox (const QPoint& p1, const QPoint& p2) = 0; |
77 virtual void resize (int x, int y, int width, int height) = 0; | 78 virtual void resize (int x, int y, int width, int height) = 0; |
83 : m_handle (handle), | 84 : m_handle (handle), |
84 m_redrawBlocked (false), | 85 m_redrawBlocked (false), |
85 m_mouseMode (NoMode), | 86 m_mouseMode (NoMode), |
86 m_clickMode (false), | 87 m_clickMode (false), |
87 m_eventMask (0), | 88 m_eventMask (0), |
88 m_rectMode (false) | 89 m_rectMode (false), |
90 m_updateCurrentPoint (false) | |
89 { } | 91 { } |
90 | 92 |
91 void canvasToggleAxes (const graphics_handle& handle); | 93 void canvasToggleAxes (const graphics_handle& handle); |
92 void canvasToggleGrid (const graphics_handle& handle); | 94 void canvasToggleGrid (const graphics_handle& handle); |
93 void canvasAutoAxes (const graphics_handle& handle); | 95 void canvasAutoAxes (const graphics_handle& handle); |
104 const graphics_object& obj, QMouseEvent *event); | 106 const graphics_object& obj, QMouseEvent *event); |
105 void updateCurrentPoint (const graphics_object& fig, | 107 void updateCurrentPoint (const graphics_object& fig, |
106 const graphics_object& obj); | 108 const graphics_object& obj); |
107 | 109 |
108 void annotation_callback (const octave_value_list& args); | 110 void annotation_callback (const octave_value_list& args); |
111 void select_object (graphics_object obj, QMouseEvent* event, | |
112 graphics_object ¤tObj, graphics_object &axesObj); | |
109 | 113 |
110 private: | 114 private: |
111 graphics_handle m_handle; | 115 graphics_handle m_handle; |
112 bool m_redrawBlocked; | 116 bool m_redrawBlocked; |
113 MouseMode m_mouseMode; | 117 MouseMode m_mouseMode; |
115 QPoint m_mouseAnchor; | 119 QPoint m_mouseAnchor; |
116 QPoint m_mouseCurrent; | 120 QPoint m_mouseCurrent; |
117 graphics_handle m_mouseAxes; | 121 graphics_handle m_mouseAxes; |
118 int m_eventMask; | 122 int m_eventMask; |
119 bool m_rectMode; | 123 bool m_rectMode; |
124 bool m_updateCurrentPoint; | |
120 }; | 125 }; |
121 | 126 |
122 }; // namespace QtHandles | 127 }; // namespace QtHandles |
123 | 128 |
124 #endif | 129 #endif |