source: ntrip/trunk/BNC/qwt/qwt_plot_glcanvas.h@ 9274

Last change on this file since 9274 was 8127, checked in by stoecker, 8 years ago

update qwt and qwtpolar, many QT5 fixes (unfinished)

File size: 3.6 KB
RevLine 
[8127]1/* -*- mode: C++ ; c-file-style: "stroustrup" -*- *****************************
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
10#ifndef QWT_PLOT_GLCANVAS_H
11#define QWT_PLOT_GLCANVAS_H
12
13#include "qwt_global.h"
14#include <qframe.h>
15#include <qgl.h>
16
17class QwtPlot;
18
19/*!
20 \brief An alternative canvas for a QwtPlot derived from QGLWidget
21
22 QwtPlotGLCanvas implements the very basics to act as canvas
23 inside of a QwtPlot widget. It might be extended to a full
24 featured alternative to QwtPlotCanvas in a future version of Qwt.
25
26 Even if QwtPlotGLCanvas is not derived from QFrame it imitates
27 its API. When using style sheets it supports the box model - beside
28 backgrounds with rounded borders.
29
30 \sa QwtPlot::setCanvas(), QwtPlotCanvas
31
32 \note With Qt4 you might want to use the QPaintEngine::OpenGL paint engine
33 ( see QGL::setPreferredPaintEngine() ). On a Linux test system
34 QPaintEngine::OpenGL2 shows very basic problems like translated
35 geometries.
36*/
37class QWT_EXPORT QwtPlotGLCanvas: public QGLWidget
38{
39 Q_OBJECT
40
41 Q_ENUMS( Shape Shadow )
42
43 Q_PROPERTY( Shadow frameShadow READ frameShadow WRITE setFrameShadow )
44 Q_PROPERTY( Shape frameShape READ frameShape WRITE setFrameShape )
45 Q_PROPERTY( int lineWidth READ lineWidth WRITE setLineWidth )
46 Q_PROPERTY( int midLineWidth READ midLineWidth WRITE setMidLineWidth )
47 Q_PROPERTY( int frameWidth READ frameWidth )
48 Q_PROPERTY( QRect frameRect READ frameRect DESIGNABLE false )
49
50public:
51 /*!
52 \brief Frame shadow
53
54 Unfortunately it is not possible to use QFrame::Shadow
55 as a property of a widget that is not derived from QFrame.
56 The following enum is made for the designer only. It is safe
57 to use QFrame::Shadow instead.
58 */
59 enum Shadow
60 {
61 //! QFrame::Plain
62 Plain = QFrame::Plain,
63
64 //! QFrame::Raised
65 Raised = QFrame::Raised,
66
67 //! QFrame::Sunken
68 Sunken = QFrame::Sunken
69 };
70
71 /*!
72 \brief Frame shape
73
74 Unfortunately it is not possible to use QFrame::Shape
75 as a property of a widget that is not derived from QFrame.
76 The following enum is made for the designer only. It is safe
77 to use QFrame::Shadow instead.
78
79 \note QFrame::StyledPanel and QFrame::WinPanel are unsuported
80 and will be displayed as QFrame::Panel.
81 */
82 enum Shape
83 {
84 NoFrame = QFrame::NoFrame,
85
86 Box = QFrame::Box,
87 Panel = QFrame::Panel
88 };
89
90 explicit QwtPlotGLCanvas( QwtPlot * = NULL );
91 virtual ~QwtPlotGLCanvas();
92
93 void setFrameStyle( int style );
94 int frameStyle() const;
95
96 void setFrameShadow( Shadow );
97 Shadow frameShadow() const;
98
99 void setFrameShape( Shape );
100 Shape frameShape() const;
101
102 void setLineWidth( int );
103 int lineWidth() const;
104
105 void setMidLineWidth( int );
106 int midLineWidth() const;
107
108 int frameWidth() const;
109 QRect frameRect() const;
110
111 Q_INVOKABLE QPainterPath borderPath( const QRect & ) const;
112
113 virtual bool event( QEvent * );
114
115public Q_SLOTS:
116 void replot();
117
118protected:
119 virtual void paintEvent( QPaintEvent * );
120
121 virtual void drawBackground( QPainter * );
122 virtual void drawBorder( QPainter * );
123 virtual void drawItems( QPainter * );
124
125private:
126 class PrivateData;
127 PrivateData *d_data;
128};
129
130#endif
Note: See TracBrowser for help on using the repository browser.