QWT API (English) 7.3.0
Qt Widget Library for Technical Applications - English API Documentation
Loading...
Searching...
No Matches
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#include <qpainterpath.h>
35
36class QwtPlot;
37class QPixmap;
38class QPainterPath;
39
45class QWT_EXPORT QwtPlotCanvas : public QFrame, public QwtPlotAbstractCanvas
46{
47 Q_OBJECT
48
49 Q_PROPERTY(double borderRadius READ borderRadius WRITE setBorderRadius)
50
51public:
58 {
68 BackingStore = 1,
69
81 Opaque = 2,
82
95 HackStyledBackground = 4,
96
102 ImmediatePaint = 8
103 };
104
105 Q_DECLARE_FLAGS(PaintAttributes, PaintAttribute)
106
107 // Constructor
108 explicit QwtPlotCanvas(QwtPlot* = nullptr);
109 // Destructor
110 ~QwtPlotCanvas() override;
111
112 // Set paint attribute
113 void setPaintAttribute(PaintAttribute, bool on = true);
114 // Test paint attribute
115 bool testPaintAttribute(PaintAttribute) const;
116
117 // Get backing store
118 const QPixmap* backingStore() const;
119 // Invalidate backing store
120 Q_INVOKABLE void invalidateBackingStore();
121
122 // Handle events
123 virtual bool event(QEvent*) override;
124
125 // Get border path
126 Q_INVOKABLE QPainterPath borderPath(const QRect&) const;
127
128public Q_SLOTS:
129 // Replot the canvas
130 void replot();
131
132protected:
134 virtual void paintEvent(QPaintEvent*) override;
136 virtual void resizeEvent(QResizeEvent*) override;
137
139 virtual void drawBorder(QPainter*) override;
140
141private:
142 QWT_DECLARE_PRIVATE(QwtPlotCanvas)
143};
144
145Q_DECLARE_OPERATORS_FOR_FLAGS(QwtPlotCanvas::PaintAttributes)
146
147#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:46
PaintAttribute
Paint attributes.
Definition qwt_plot_canvas.h:58
A 2-D plotting widget.
Definition qwt_plot.h:100