QWT API (中文) 7.3.0
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
43class QWT_EXPORT QwtMagnifier : public QObject
44{
45 Q_OBJECT
46
47public:
48 // Constructor
49 explicit QwtMagnifier(QWidget*);
50 // Destructor
51 ~QwtMagnifier() override;
52
53 // Return the parent widget (non-const version)
54 QWidget* parentWidget();
55 // Return the parent widget (const version)
56 const QWidget* parentWidget() const;
57
58 // Enable or disable the magnifier
59 void setEnabled(bool);
60 // Return whether the magnifier is enabled
61 bool isEnabled() const;
62
63 // mouse
64
65 // Set the mouse factor for zooming
66 void setMouseFactor(double);
67 // Return the mouse factor
68 double mouseFactor() const;
69
70 // Set the mouse button for zooming
71 void setMouseButton(Qt::MouseButton, Qt::KeyboardModifiers = Qt::NoModifier);
72 // Get the mouse button and modifiers
73 void getMouseButton(Qt::MouseButton&, Qt::KeyboardModifiers&) const;
74
75 // mouse wheel
76
77 // Set the wheel factor for zooming
78 void setWheelFactor(double);
79 // Return the wheel factor
80 double wheelFactor() const;
81
82 // Set the wheel modifiers
83 void setWheelModifiers(Qt::KeyboardModifiers);
84 // Return the wheel modifiers
85 Qt::KeyboardModifiers wheelModifiers() const;
86
87 // keyboard
88
89 // Set the key factor for zooming
90 void setKeyFactor(double);
91 // Return the key factor
92 double keyFactor() const;
93
94 // Set the zoom in key and modifiers
95 void setZoomInKey(int key, Qt::KeyboardModifiers = Qt::NoModifier);
96 // Get the zoom in key and modifiers
97 void getZoomInKey(int& key, Qt::KeyboardModifiers&) const;
98
99 // Set the zoom out key and modifiers
100 void setZoomOutKey(int key, Qt::KeyboardModifiers = Qt::NoModifier);
101 // Get the zoom out key and modifiers
102 void getZoomOutKey(int& key, Qt::KeyboardModifiers&) const;
103
104 // Event filter for mouse and keyboard events
105 virtual bool eventFilter(QObject*, QEvent*) override;
106
107protected:
108 // Rescale the parent widget
109 virtual void rescale(double factor) = 0;
110
111 virtual void widgetMousePressEvent(QMouseEvent*);
112 virtual void widgetMouseReleaseEvent(QMouseEvent*);
113 virtual void widgetMouseMoveEvent(QMouseEvent*);
114 virtual void widgetWheelEvent(QWheelEvent*);
115 virtual void widgetKeyPressEvent(QKeyEvent*);
116 virtual void widgetKeyReleaseEvent(QKeyEvent*);
117
118private:
119 QWT_DECLARE_PRIVATE(QwtMagnifier)
120};
121
122#endif
QwtMagnifier provides zooming by magnifying in steps
Definition qwt_magnifier.h:44