QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_plot_opengl_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_OPENGL_CANVAS_H
28#define QWT_PLOT_OPENGL_CANVAS_H
29
30#include "qwt_global.h"
31#include "qwt_plot_abstract_canvas.h"
32#if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0)
33#include <QtOpenGLWidgets/QOpenGLWidget>
34#else
35#include <QOpenGLWidget>
36#endif
37#include <QSurfaceFormat>
38#include <QPainterPath>
39
40class QwtPlot;
41
55class QWT_EXPORT QwtPlotOpenGLCanvas : public QOpenGLWidget, public QwtPlotAbstractGLCanvas
56{
57 Q_OBJECT
58
59 Q_PROPERTY(QFrame::Shadow frameShadow READ frameShadow WRITE setFrameShadow)
60 Q_PROPERTY(QFrame::Shape frameShape READ frameShape WRITE setFrameShape)
61 Q_PROPERTY(int lineWidth READ lineWidth WRITE setLineWidth)
62 Q_PROPERTY(int midLineWidth READ midLineWidth WRITE setMidLineWidth)
63 Q_PROPERTY(int frameWidth READ frameWidth)
64 Q_PROPERTY(QRect frameRect READ frameRect DESIGNABLE false)
65
66 Q_PROPERTY(double borderRadius READ borderRadius WRITE setBorderRadius)
67
68public:
72 explicit QwtPlotOpenGLCanvas(QwtPlot* = nullptr);
76 explicit QwtPlotOpenGLCanvas(const QSurfaceFormat&, QwtPlot* = nullptr);
80 ~QwtPlotOpenGLCanvas() override;
81
85 Q_INVOKABLE virtual void invalidateBackingStore() override;
89 Q_INVOKABLE QPainterPath borderPath(const QRect&) const;
90
94 virtual bool event(QEvent*) override;
95
96public Q_SLOTS:
100 void replot();
101
102protected:
106 virtual void paintEvent(QPaintEvent*) override;
107
111 virtual void initializeGL() override;
115 virtual void paintGL() override;
119 virtual void resizeGL(int width, int height) override;
120
121private:
125 void init(const QSurfaceFormat&);
129 virtual void clearBackingStore() override;
130
131 QWT_DECLARE_PRIVATE(QwtPlotOpenGLCanvas)
132};
133
134#endif
Base class of QwtPlotOpenGLCanvas and QwtPlotGLCanvas
Definition qwt_plot_abstract_canvas.h:115
virtual void invalidateBackingStore()=0
Invalidate the internal backing store
void replot()
Invalidate the paint cache and repaint the canvas
Definition qwt_plot_abstract_canvas.cpp:755
An alternative canvas for a QwtPlot derived from QOpenGLWidget
Definition qwt_plot_opengl_canvas.h:56
QwtPlotOpenGLCanvas(const QSurfaceFormat &, QwtPlot *=nullptr)
Constructor with surface format
A 2-D plotting widget
Definition qwt_plot.h:100