QWT API (中文) 7.0.1
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
146class QWT_EXPORT QwtPlotAxisZoomer : public QwtPlotPicker
147{
148 Q_OBJECT
149public:
150 // Constructor
151 explicit QwtPlotAxisZoomer(QWidget*, bool doReplot = true);
152 // Constructor with specified axes
153 explicit QwtPlotAxisZoomer(QwtAxisId xAxis, QwtAxisId yAxis, QWidget*, bool doReplot = true);
154
155 // Destructor
156 virtual ~QwtPlotAxisZoomer();
157
158 // Set zoom base from current scales
159 virtual void setZoomBase(bool doReplot = true);
160 // Set zoom base from a rectangle
161 virtual void setZoomBase(const QRectF&);
162
163 // Get zoom base rectangle
164 QRectF zoomBase() const;
165 // Get current zoom rectangle
166 QRectF zoomRect() const;
167
168 // Set the axes for the zoomer
169 virtual void setAxes(QwtAxisId xAxis, QwtAxisId yAxis) override;
170
171 // Set maximum zoom stack depth
172 void setMaxStackDepth(int);
173 // Get maximum zoom stack depth
174 int maxStackDepth() const;
175
176 // Get the zoom stack
177 const QStack< QRectF >& zoomStack() const;
178 // Set the zoom stack
179 void setZoomStack(const QStack< QRectF >&, int zoomRectIndex = -1);
180
181 // Get current zoom rectangle index in stack
182 uint zoomRectIndex() const;
183
184public Q_SLOTS:
185 // Move zoom rectangle by offset
186 void moveBy(double dx, double dy);
187 // Move zoom rectangle to position
188 virtual void moveTo(const QPointF&);
189
190 // Zoom to a rectangle
191 virtual void zoom(const QRectF&);
192 // Zoom by offset in stack
193 virtual void zoom(int offset);
194
195Q_SIGNALS:
208 void zoomed(const QRectF& rect);
209
210protected:
212 virtual void rescale();
213
215 virtual QSizeF minZoomSize() const;
216
218 virtual void widgetMouseReleaseEvent(QMouseEvent*) override;
220 virtual void widgetKeyPressEvent(QKeyEvent*) override;
221
223 virtual void begin() override;
225 virtual bool end(bool ok = true) override;
227 virtual bool accept(QPolygon&) const override;
228
229private:
231 void init(bool doReplot);
232
233 class PrivateData;
234 PrivateData* m_data;
235};
236
237#endif
Definition qwt_plot_axis_zoomer.h:35
virtual void begin()
Open a selection setting the state to active
Definition qwt_picker.cpp:1405
virtual bool accept(QPolygon &) const
Validate and fix up the selection
Definition qwt_picker.cpp:1541
virtual void widgetMouseReleaseEvent(QMouseEvent *)
Handle a mouse release event for the observed widget.
Definition qwt_picker.cpp:1231
virtual void widgetKeyPressEvent(QKeyEvent *)
Handle a key press event for the observed widget.
Definition qwt_picker.cpp:1292
QwtPlotAxisZoomer 为绘图部件提供堆叠式缩放功能
Definition qwt_plot_axis_zoomer.h:147
void zoomed(const QRectF &rect)
QwtPlotPicker 提供绘图画布上的选择功能
Definition qwt_plot_picker.h:37
virtual bool end(bool ok=true) override
End the selection
Definition qwt_plot_picker.cpp:374
virtual void setAxes(QwtAxisId xAxisId, QwtAxisId yAxisId)
Set the x and y axes
Definition qwt_plot_picker.cpp:249