QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_magnifier.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_MAGNIFIER_H
28#define QWT_MAGNIFIER_H
29
30#include "qwt_global.h"
31#include <qobject.h>
32
33class QWidget;
34class QMouseEvent;
35class QWheelEvent;
36class QKeyEvent;
37
50class QWT_EXPORT QwtMagnifier : public QObject
51{
52 Q_OBJECT
53
54 public:
55 // Constructor
56 explicit QwtMagnifier( QWidget* );
57 // Destructor
58 virtual ~QwtMagnifier();
59
60 // Return the parent widget (non-const version)
61 QWidget* parentWidget();
62 // Return the parent widget (const version)
63 const QWidget* parentWidget() const;
64
65 // Enable or disable the magnifier
66 void setEnabled( bool );
67 // Return whether the magnifier is enabled
68 bool isEnabled() const;
69
70 // mouse
71
72 // Set the mouse factor for zooming
73 void setMouseFactor( double );
74 // Return the mouse factor
75 double mouseFactor() const;
76
77 // Set the mouse button for zooming
78 void setMouseButton( Qt::MouseButton, Qt::KeyboardModifiers = Qt::NoModifier );
79 // Get the mouse button and modifiers
80 void getMouseButton( Qt::MouseButton&, Qt::KeyboardModifiers& ) const;
81
82 // mouse wheel
83
84 // Set the wheel factor for zooming
85 void setWheelFactor( double );
86 // Return the wheel factor
87 double wheelFactor() const;
88
89 // Set the wheel modifiers
90 void setWheelModifiers( Qt::KeyboardModifiers );
91 // Return the wheel modifiers
92 Qt::KeyboardModifiers wheelModifiers() const;
93
94 // keyboard
95
96 // Set the key factor for zooming
97 void setKeyFactor( double );
98 // Return the key factor
99 double keyFactor() const;
100
101 // Set the zoom in key and modifiers
102 void setZoomInKey( int key, Qt::KeyboardModifiers = Qt::NoModifier );
103 // Get the zoom in key and modifiers
104 void getZoomInKey( int& key, Qt::KeyboardModifiers& ) const;
105
106 // Set the zoom out key and modifiers
107 void setZoomOutKey( int key, Qt::KeyboardModifiers = Qt::NoModifier );
108 // Get the zoom out key and modifiers
109 void getZoomOutKey( int& key, Qt::KeyboardModifiers& ) const;
110
111 // Event filter for mouse and keyboard events
112 virtual bool eventFilter( QObject*, QEvent* ) override;
113
114 protected:
125 virtual void rescale( double factor ) = 0;
126
127 virtual void widgetMousePressEvent( QMouseEvent* );
128 virtual void widgetMouseReleaseEvent( QMouseEvent* );
129 virtual void widgetMouseMoveEvent( QMouseEvent* );
130 virtual void widgetWheelEvent( QWheelEvent* );
131 virtual void widgetKeyPressEvent( QKeyEvent* );
132 virtual void widgetKeyReleaseEvent( QKeyEvent* );
133
134 private:
135 class PrivateData;
136 PrivateData* m_data;
137};
138
139#endif
QwtMagnifier 提供逐步放大的缩放功能
Definition qwt_magnifier.h:51
virtual void rescale(double factor)=0
重新缩放父控件