QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_axis_zoomer.h
1/******************************************************************************
2 * Qwt Widget Library
3 * Copyright (C) 1997 Josef Wilgen
4 * Copyright (C) 2002 Uwe Rathmann
5 *
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the Qwt License, Version 1.0
8 *
9 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_PLOT_AXIS_ZOOMER_H
28#define QWT_PLOT_AXIS_ZOOMER_H
29
30#include "qwt_global.h"
31#include "qwt_plot_picker.h"
32
33class QSizeF;
34template< typename T >
35class QStack;
36
95class QWT_EXPORT QwtPlotAxisZoomer : public QwtPlotPicker
96{
97 Q_OBJECT
98public:
99 // Constructor
100 explicit QwtPlotAxisZoomer(QWidget*, bool doReplot = true);
101 // Constructor with specified axes
102 explicit QwtPlotAxisZoomer(QwtAxisId xAxis, QwtAxisId yAxis, QWidget*, bool doReplot = true);
103
104 // Destructor
105 ~QwtPlotAxisZoomer() override;
106
107 // Set zoom base from current scales
108 virtual void setZoomBase(bool doReplot = true);
109 // Set zoom base from a rectangle
110 virtual void setZoomBase(const QRectF&);
111
112 // Get zoom base rectangle
113 QRectF zoomBase() const;
114 // Get current zoom rectangle
115 QRectF zoomRect() const;
116
117 // Set the axes for the zoomer
118 virtual void setAxes(QwtAxisId xAxis, QwtAxisId yAxis) override;
119
120 // Set maximum zoom stack depth
121 void setMaxStackDepth(int);
122 // Get maximum zoom stack depth
123 int maxStackDepth() const;
124
125 // Get the zoom stack
126 const QStack< QRectF >& zoomStack() const;
127 // Set the zoom stack
128 void setZoomStack(const QStack< QRectF >&, int zoomRectIndex = -1);
129
130 // Get current zoom rectangle index in stack
131 uint zoomRectIndex() const;
132
133public Q_SLOTS:
134 // Move zoom rectangle by offset
135 void moveBy(double dx, double dy);
136 // Move zoom rectangle to position
137 virtual void moveTo(const QPointF&);
138
139 // Zoom to a rectangle
140 virtual void zoom(const QRectF&);
141 // Zoom by offset in stack
142 virtual void zoom(int offset);
143
144Q_SIGNALS:
151 void zoomed(const QRectF& rect);
152
153protected:
155 virtual void rescale();
156
158 virtual QSizeF minZoomSize() const;
159
161 virtual void widgetMouseReleaseEvent(QMouseEvent*) override;
163 virtual void widgetKeyPressEvent(QKeyEvent*) override;
164
166 virtual void begin() override;
168 virtual bool end(bool ok = true) override;
170 virtual bool accept(QPolygon&) const override;
171
172private:
174 void init(bool doReplot);
175
176 QWT_DECLARE_PRIVATE(QwtPlotAxisZoomer)
177};
178
179#endif
Definition qwt_plot_axis_zoomer.h:35
virtual void begin()
Open a selection setting the state to active
Definition qwt_picker.cpp:1147
virtual bool accept(QPolygon &) const
Validate and fix up the selection
Definition qwt_picker.cpp:1283
virtual void widgetMouseReleaseEvent(QMouseEvent *)
Handle a mouse release event for the observed widget.
Definition qwt_picker.cpp:973
virtual void widgetKeyPressEvent(QKeyEvent *)
Handle a key press event for the observed widget.
Definition qwt_picker.cpp:1034
QwtPlotAxisZoomer provides stacked zooming for a plot widget
Definition qwt_plot_axis_zoomer.h:96
void zoomed(const QRectF &rect)
QwtPlotPicker provides selections on a plot canvas
Definition qwt_plot_picker.h:29
virtual bool end(bool ok=true) override
End the selection
Definition qwt_plot_picker.cpp:281
virtual void setAxes(QwtAxisId xAxisId, QwtAxisId yAxisId)
Set the x and y axes
Definition qwt_plot_picker.cpp:167