Qwt User's Guide: qwt_plot_shapeitem.h Source File

Qwt User's Guide 6.2.0

qwt_plot_shapeitem.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
10 #ifndef QWT_PLOT_SHAPE_ITEM_H
11 #define QWT_PLOT_SHAPE_ITEM_H
12
13 #include "qwt_global.h"
14 #include "qwt_plot_item.h"
15
16 #include <qstring.h>
17
18 class QPainterPath;
19 class QPolygonF;
20
38 class QWT_EXPORT QwtPlotShapeItem : public QwtPlotItem
39 {
40 public:
47 enum PaintAttribute
48 {
58 ClipPolygons = 0x01,
59 };
60
61 Q_DECLARE_FLAGS( PaintAttributes, PaintAttribute )
62
63
64 enum LegendMode
65 {
67 LegendShape,
68
70 LegendColor
71 };
72
73 explicit QwtPlotShapeItem( const QString& title = QString() );
74 explicit QwtPlotShapeItem( const QwtText& title );
75
76 virtual ~QwtPlotShapeItem();
77
78 void setPaintAttribute( PaintAttribute, bool on = true );
79 bool testPaintAttribute( PaintAttribute ) const;
80
81 void setLegendMode( LegendMode );
82 LegendMode legendMode() const;
83
84 void setRect( const QRectF& );
85 void setPolygon( const QPolygonF& );
86
87 void setShape( const QPainterPath& );
88 QPainterPath shape() const;
89
90 void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
91 void setPen( const QPen& );
92 QPen pen() const;
93
94 void setBrush( const QBrush& );
95 QBrush brush() const;
96
97 void setRenderTolerance( double );
98 double renderTolerance() const;
99
100 virtual QRectF boundingRect() const QWT_OVERRIDE;
101
102 virtual void draw( QPainter*,
103 const QwtScaleMap& xMap, const QwtScaleMap& yMap,
104 const QRectF& canvasRect ) const QWT_OVERRIDE;
105
106 virtual QwtGraphic legendIcon(
107 int index, const QSizeF& ) const QWT_OVERRIDE;
108
109 virtual int rtti() const QWT_OVERRIDE;
110
111 private:
112 void init();
113
114 class PrivateData;
115 PrivateData* m_data;
116 };
117
118 #endif
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:76
QwtPlotItem
Base class for items on the plot canvas.
Definition: qwt_plot_item.h:67
QwtPlotItem::boundingRect
virtual QRectF boundingRect() const
Definition: qwt_plot_item.cpp:568
QwtPlotShapeItem
A plot item, which displays any graphical shape, that can be defined by a QPainterPath.
Definition: qwt_plot_shapeitem.h:39
QwtPlotShapeItem::LegendMode
LegendMode
Mode how to display the item on the legend.
Definition: qwt_plot_shapeitem.h:65
QwtPlotShapeItem::LegendShape
@ LegendShape
Display a scaled down version of the shape.
Definition: qwt_plot_shapeitem.h:67
QwtPlotShapeItem::PaintAttribute
PaintAttribute
Definition: qwt_plot_shapeitem.h:48
QwtPlotShapeItem::PaintAttributes
QFlags< PaintAttribute > PaintAttributes
Definition: qwt_plot_shapeitem.h:61
QwtScaleMap
A scale map.
Definition: qwt_scale_map.h:27
QwtText
A class representing a text.
Definition: qwt_text.h:52