QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_canvas.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_CANVAS_H
28#define QWT_PLOT_CANVAS_H
29
30#include "qwt_global.h"
31#include "qwt_plot_abstract_canvas.h"
32
33#include <qframe.h>
34
35class QwtPlot;
36class QPixmap;
37class QPainterPath;
38
44class QWT_EXPORT QwtPlotCanvas : public QFrame, public QwtPlotAbstractCanvas
45{
46 Q_OBJECT
47
48 Q_PROPERTY(double borderRadius READ borderRadius WRITE setBorderRadius)
49
50public:
57 {
67 BackingStore = 1,
68
80 Opaque = 2,
81
94 HackStyledBackground = 4,
95
101 ImmediatePaint = 8
102 };
103
104 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
105
106 // Constructor
107 explicit QwtPlotCanvas(QwtPlot* = nullptr);
108 // Destructor
109 ~QwtPlotCanvas() override;
110
111 // Set paint attribute
112 void setPaintAttribute(PaintAttribute, bool on = true);
113 // Test paint attribute
114 bool testPaintAttribute(PaintAttribute) const;
115
116 // Get backing store
117 const QPixmap* backingStore() const;
118 // Invalidate backing store
119 Q_INVOKABLE void invalidateBackingStore();
120
121 // Handle events
122 virtual bool event(QEvent*) override;
123
124 // Get border path
125 Q_INVOKABLE QPainterPath borderPath(const QRect&) const;
126
127public Q_SLOTS:
128 // Replot the canvas
129 void replot();
130
131protected:
133 virtual void paintEvent(QPaintEvent*) override;
135 virtual void resizeEvent(QResizeEvent*) override;
136
138 virtual void drawBorder(QPainter*) override;
139
140private:
141 QWT_DECLARE_PRIVATE(QwtPlotCanvas)
142};
143
144Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotCanvas::PaintAttributes)
145
146#endif
Base class for all type of plot canvases
Definition qwt_plot_abstract_canvas.h:39
virtual void drawBorder(QPainter *)
Draw the border of the canvas
Definition qwt_plot_abstract_canvas.cpp:310
Canvas of a QwtPlot
Definition qwt_plot_canvas.h:45
PaintAttribute
Paint attributes
Definition qwt_plot_canvas.h:57
A 2-D plotting widget
Definition qwt_plot.h:99