QWT API (中文) 7.3.0
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
49class QWT_EXPORT QwtCachePanner : public QWidget
50{
51 Q_OBJECT
52
53public:
54 // Constructor with parent widget
55 explicit QwtCachePanner(QWidget* parent);
56 // Destructor
57 ~QwtCachePanner() override;
58
59 // Enable or disable the panner
60 void setEnabled(bool);
61 // Return whether the panner is enabled
62 bool isEnabled() const;
63
64 // Set the mouse button and modifiers for panning
65 void setMouseButton(Qt::MouseButton, Qt::KeyboardModifiers = Qt::NoModifier);
66 // Get the mouse button and modifiers used for panning
67 void getMouseButton(Qt::MouseButton& button, Qt::KeyboardModifiers&) const;
68
69 // Set the abort key and modifiers
70 void setAbortKey(int key, Qt::KeyboardModifiers = Qt::NoModifier);
71 // Get the abort key and modifiers
72 void getAbortKey(int& key, Qt::KeyboardModifiers&) const;
73
74 // Set the cursor active while panning
75 void setCursor(const QCursor&);
76 // Return the cursor active while panning
77 const QCursor cursor() const;
78
79 // Set orientations where panning is enabled
80 void setOrientations(Qt::Orientations);
81 // Return orientations where panning is enabled
82 Qt::Orientations orientations() const;
83
84 // Check if an orientation is enabled for panning
85 bool isOrientationEnabled(Qt::Orientation) const;
86
87 // Event filter for the parent widget
88 virtual bool eventFilter(QObject*, QEvent*) override;
89
90Q_SIGNALS:
96 void panned(int dx, int dy);
97
103 void moved(int dx, int dy);
104
105protected:
106 virtual void widgetMousePressEvent(QMouseEvent*);
107 virtual void widgetMouseReleaseEvent(QMouseEvent*);
108 virtual void widgetMouseMoveEvent(QMouseEvent*);
109 virtual void widgetKeyPressEvent(QKeyEvent*);
110 virtual void widgetKeyReleaseEvent(QKeyEvent*);
111
112 virtual void paintEvent(QPaintEvent*) override;
113
114 virtual QBitmap contentsMask() const;
115 virtual QPixmap grab() const;
116
117private:
118#ifndef QT_NO_CURSOR
119 void showCursor(bool);
120#endif
121
122 QWT_DECLARE_PRIVATE(QwtCachePanner)
123};
124
125#endif
QwtCachePanner provides panning of a widget
Definition qwt_cache_panner.h:50
void moved(int dx, int dy)
Signal emitted while the widget moved, but panning is not finished
void panned(int dx, int dy)
Signal emitted when panning is done