Changeset 11158 in ntrip for trunk/BNC/qwt/qwt_plot_zoomer.h
- Timestamp:
- Nov 3, 2026, 10:53:35 AM (3 weeks ago)
- File:
-
- 1 edited
-
trunk/BNC/qwt/qwt_plot_zoomer.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/BNC/qwt/qwt_plot_zoomer.h
r9383 r11158 1 /* -*- mode: C++ ; c-file-style: "stroustrup" -*-*****************************1 /****************************************************************************** 2 2 * Qwt Widget Library 3 3 * Copyright (C) 1997 Josef Wilgen … … 13 13 #include "qwt_global.h" 14 14 #include "qwt_plot_picker.h" 15 #include <qstack.h> 15 16 class QSizeF; 17 template< typename T > class QStack; 16 18 17 19 /*! 18 \brief QwtPlotZoomer provides stacked zooming for a plot widget 20 \brief QwtPlotZoomer provides stacked zooming for a plot widget 19 21 20 QwtPlotZoomer selects rectangles from user inputs ( mouse or keyboard ) 21 translates them into plot coordinates and adjusts the axes to them. 22 The selection is supported by a rubber band and optionally by displaying 23 the coordinates of the current mouse position. 22 QwtPlotZoomer selects rectangles from user inputs ( mouse or keyboard ) 23 translates them into plot coordinates and adjusts the axes to them. 24 The selection is supported by a rubber band and optionally by displaying 25 the coordinates of the current mouse position. 24 26 25 Zooming can be repeated as often as possible, limited only by 26 maxStackDepth() or minZoomSize(). Each rectangle is pushed on a stack. 27 Zooming can be repeated as often as possible, limited only by 28 maxStackDepth() or minZoomSize(). Each rectangle is pushed on a stack. 27 29 28 The default setting how to select rectangles is 29 a QwtPickerDragRectMachine with the following bindings: 30 The default setting how to select rectangles is 31 a QwtPickerDragRectMachine with the following bindings: 30 32 31 - QwtEventPattern::MouseSelect1\n 33 - QwtEventPattern::MouseSelect1\n 32 34 The first point of the zoom rectangle is selected by a mouse press, 33 35 the second point from the position, where the mouse is released. 34 36 35 - QwtEventPattern::KeySelect1\n 37 - QwtEventPattern::KeySelect1\n 36 38 The first key press selects the first, the second key press 37 39 selects the second point. 38 40 39 - QwtEventPattern::KeyAbort\n 41 - QwtEventPattern::KeyAbort\n 40 42 Discard the selection in the state, where the first point 41 43 is selected. 42 44 43 To traverse the zoom stack the following bindings are used: 45 To traverse the zoom stack the following bindings are used: 44 46 45 - QwtEventPattern::MouseSelect3, QwtEventPattern::KeyUndo\n 47 - QwtEventPattern::MouseSelect3, QwtEventPattern::KeyUndo\n 46 48 Zoom out one position on the zoom stack 47 49 48 - QwtEventPattern::MouseSelect6, QwtEventPattern::KeyRedo\n 50 - QwtEventPattern::MouseSelect6, QwtEventPattern::KeyRedo\n 49 51 Zoom in one position on the zoom stack 50 52 51 - QwtEventPattern::MouseSelect2, QwtEventPattern::KeyHome\n 53 - QwtEventPattern::MouseSelect2, QwtEventPattern::KeyHome\n 52 54 Zoom to the zoom base 53 55 54 The setKeyPattern() and setMousePattern() functions can be used 55 to configure the zoomer actions. The following example 56 shows, how to configure the 'I' and 'O' keys for zooming in and out 57 one position on the zoom stack. The "Home" key is used to 58 "unzoom" the plot. 56 The setKeyPattern() and setMousePattern() functions can be used 57 to configure the zoomer actions. The following example 58 shows, how to configure the 'I' and 'O' keys for zooming in and out 59 one position on the zoom stack. The "Home" key is used to 60 "unzoom" the plot. 59 61 60 \code 62 \code 61 63 zoomer = new QwtPlotZoomer( plot ); 62 64 zoomer->setKeyPattern( QwtEventPattern::KeyRedo, Qt::Key_I, Qt::ShiftModifier ); 63 65 zoomer->setKeyPattern( QwtEventPattern::KeyUndo, Qt::Key_O, Qt::ShiftModifier ); 64 66 zoomer->setKeyPattern( QwtEventPattern::KeyHome, Qt::Key_Home ); 65 \endcode 67 \endcode 66 68 67 QwtPlotZoomer is tailored for plots with one x and y axis, but it is 68 allowed to attach a second QwtPlotZoomer ( without rubber band and tracker ) 69 for the other axes. 69 QwtPlotZoomer is tailored for plots with one x and y axis, but it is 70 allowed to attach a second QwtPlotZoomer ( without rubber band and tracker ) 71 for the other axes. 70 72 71 \note The realtime example includes an derived zoomer class that adds 73 \note The realtime example includes an derived zoomer class that adds 72 74 scrollbars to the plot canvas. 73 75 74 \sa QwtPlotPanner, QwtPlotMagnifier 75 */ 76 \sa QwtPlotPanner, QwtPlotMagnifier 77 */ 76 78 77 class QWT_EXPORT QwtPlotZoomer: public QwtPlotPicker 79 class QWT_EXPORT QwtPlotZoomer : public QwtPlotPicker 78 80 { 79 81 Q_OBJECT 80 public: 81 explicit QwtPlotZoomer( QWidget *, bool doReplot = true );82 explicit QwtPlotZoomer( intxAxis,intyAxis,83 QWidget*, bool doReplot = true );82 public: 83 explicit QwtPlotZoomer( QWidget*, bool doReplot = true ); 84 explicit QwtPlotZoomer( QwtAxisId xAxis, QwtAxisId yAxis, 85 QWidget*, bool doReplot = true ); 84 86 85 87 virtual ~QwtPlotZoomer(); 86 88 87 89 virtual void setZoomBase( bool doReplot = true ); 88 virtual void setZoomBase( const QRectF & );90 virtual void setZoomBase( const QRectF& ); 89 91 90 92 QRectF zoomBase() const; 91 93 QRectF zoomRect() const; 92 94 93 virtual void setAx is( intxAxis,intyAxis );95 virtual void setAxes( QwtAxisId xAxis, QwtAxisId yAxis ) QWT_OVERRIDE; 94 96 95 97 void setMaxStackDepth( int ); 96 98 int maxStackDepth() const; 97 99 98 const QStack< QRectF> &zoomStack() const;99 void setZoomStack( const QStack< QRectF>&,100 const QStack< QRectF >& zoomStack() const; 101 void setZoomStack( const QStack< QRectF >&, 100 102 int zoomRectIndex = -1 ); 101 103 102 104 uint zoomRectIndex() const; 103 105 104 public Q_SLOTS: 106 public Q_SLOTS: 105 107 void moveBy( double dx, double dy ); 106 virtual void moveTo( const QPointF & );108 virtual void moveTo( const QPointF& ); 107 109 108 virtual void zoom( const QRectF & );110 virtual void zoom( const QRectF& ); 109 111 virtual void zoom( int offset ); 110 112 111 Q_SIGNALS: 113 Q_SIGNALS: 112 114 /*! 113 A signal emitting the zoomRect(), when the plot has been 114 zoomed in or out. 115 A signal emitting the zoomRect(), when the plot has been 116 zoomed in or out. 115 117 116 \param rect Current zoom rectangle. 117 */ 118 \param rect Current zoom rectangle. 119 */ 118 120 119 void zoomed( const QRectF &rect );121 void zoomed( const QRectF& rect ); 120 122 121 protected: 123 protected: 122 124 virtual void rescale(); 123 125 124 126 virtual QSizeF minZoomSize() const; 125 127 126 virtual void widgetMouseReleaseEvent( QMouseEvent * );127 virtual void widgetKeyPressEvent( QKeyEvent * );128 virtual void widgetMouseReleaseEvent( QMouseEvent* ) QWT_OVERRIDE; 129 virtual void widgetKeyPressEvent( QKeyEvent* ) QWT_OVERRIDE; 128 130 129 virtual void begin(); 130 virtual bool end( bool ok = true ); 131 virtual bool accept( QPolygon & ) const;131 virtual void begin() QWT_OVERRIDE; 132 virtual bool end( bool ok = true ) QWT_OVERRIDE; 133 virtual bool accept( QPolygon& ) const QWT_OVERRIDE; 132 134 133 private: 135 private: 134 136 void init( bool doReplot ); 135 137 136 138 class PrivateData; 137 PrivateData *d_data;139 PrivateData* m_data; 138 140 }; 139 141
Note:
See TracChangeset
for help on using the changeset viewer.
