QWT API (中文) 7.0.1
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_cache_panner.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_CACHE_PANNER_H
28#define QWT_CACHE_PANNER_H
29
30#include "qwt_global.h"
31#include <qwidget.h>
32
33class QCursor;
34class QPixmap;
35
62class QWT_EXPORT QwtCachePanner : public QWidget
63{
64 Q_OBJECT
65
66public:
67 // Constructor with parent widget
68 explicit QwtCachePanner(QWidget* parent);
69 // Destructor
70 virtual ~QwtCachePanner();
71
72 // Enable or disable the panner
73 void setEnabled(bool);
74 // Return whether the panner is enabled
75 bool isEnabled() const;
76
77 // Set the mouse button and modifiers for panning
78 void setMouseButton(Qt::MouseButton, Qt::KeyboardModifiers = Qt::NoModifier);
79 // Get the mouse button and modifiers used for panning
80 void getMouseButton(Qt::MouseButton& button, Qt::KeyboardModifiers&) const;
81
82 // Set the abort key and modifiers
83 void setAbortKey(int key, Qt::KeyboardModifiers = Qt::NoModifier);
84 // Get the abort key and modifiers
85 void getAbortKey(int& key, Qt::KeyboardModifiers&) const;
86
87 // Set the cursor active while panning
88 void setCursor(const QCursor&);
89 // Return the cursor active while panning
90 const QCursor cursor() const;
91
92 // Set orientations where panning is enabled
93 void setOrientations(Qt::Orientations);
94 // Return orientations where panning is enabled
95 Qt::Orientations orientations() const;
96
97 // Check if an orientation is enabled for panning
98 bool isOrientationEnabled(Qt::Orientation) const;
99
100 // Event filter for the parent widget
101 virtual bool eventFilter(QObject*, QEvent*) override;
102
103Q_SIGNALS:
116 void panned(int dx, int dy);
117
130 void moved(int dx, int dy);
131
132protected:
133 virtual void widgetMousePressEvent(QMouseEvent*);
134 virtual void widgetMouseReleaseEvent(QMouseEvent*);
135 virtual void widgetMouseMoveEvent(QMouseEvent*);
136 virtual void widgetKeyPressEvent(QKeyEvent*);
137 virtual void widgetKeyReleaseEvent(QKeyEvent*);
138
139 virtual void paintEvent(QPaintEvent*) override;
140
141 virtual QBitmap contentsMask() const;
142 virtual QPixmap grab() const;
143
144private:
145#ifndef QT_NO_CURSOR
146 void showCursor(bool);
147#endif
148
149 class PrivateData;
150 PrivateData* m_data;
151};
152
153#endif
QwtCachePanner 提供控件的拖动平移功能
Definition qwt_cache_panner.h:63
void moved(int dx, int dy)
控件移动但平移未完成时发出的信号
void panned(int dx, int dy)
平移完成时发出的信号