qwt_symbol.h
Go to the documentation of this file.
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_SYMBOL_H
11 #define QWT_SYMBOL_H
12 
13 #include "qwt_global.h"
14 
15 #include <qpolygon.h>
16 #include <qpen.h>
17 #include <qbrush.h>
18 
19 class QPainter;
20 class QSize;
21 class QBrush;
22 class QPen;
23 class QColor;
24 class QPointF;
25 class QPainterPath;
26 class QPixmap;
27 class QByteArray;
28 class QwtGraphic;
29 
32 {
33  public:
38  enum Style
39  {
41  NoSymbol = -1,
42 
45 
48 
51 
54 
57 
60 
63 
66 
69 
72 
75 
78 
81 
84 
87 
96 
104 
112 
120 
126  UserStyle = 1000
127  };
128 
151  {
154 
157 
164  AutoCache
165  };
166 
167  public:
168  explicit QwtSymbol( Style = NoSymbol );
169  QwtSymbol( Style, const QBrush&, const QPen&, const QSize& );
170  QwtSymbol( const QPainterPath&, const QBrush&, const QPen& );
171 
172  virtual ~QwtSymbol();
173 
174  void setCachePolicy( CachePolicy );
175  CachePolicy cachePolicy() const;
176 
177  void setSize( const QSize& );
178  void setSize( int width, int height = -1 );
179  const QSize& size() const;
180 
181  void setPinPoint( const QPointF& pos, bool enable = true );
182  QPointF pinPoint() const;
183 
184  void setPinPointEnabled( bool );
185  bool isPinPointEnabled() const;
186 
187  virtual void setColor( const QColor& );
188 
189  void setBrush( const QBrush& );
190  const QBrush& brush() const;
191 
192  void setPen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
193  void setPen( const QPen& );
194  const QPen& pen() const;
195 
196  void setStyle( Style );
197  Style style() const;
198 
199  void setPath( const QPainterPath& );
200  const QPainterPath& path() const;
201 
202  void setPixmap( const QPixmap& );
203  const QPixmap& pixmap() const;
204 
205  void setGraphic( const QwtGraphic& );
206  const QwtGraphic& graphic() const;
207 
208 #ifndef QWT_NO_SVG
209  void setSvgDocument( const QByteArray& );
210 #endif
211 
212  void drawSymbol( QPainter*, const QRectF& ) const;
213  void drawSymbol( QPainter*, const QPointF& ) const;
214  void drawSymbols( QPainter*, const QPolygonF& ) const;
215  void drawSymbols( QPainter*,
216  const QPointF*, int numPoints ) const;
217 
218  virtual QRect boundingRect() const;
219  void invalidateCache();
220 
221  protected:
222  virtual void renderSymbols( QPainter*,
223  const QPointF*, int numPoints ) const;
224 
225  private:
226  Q_DISABLE_COPY(QwtSymbol)
227 
228  class PrivateData;
229  PrivateData* m_data;
230 };
231 
238 inline void QwtSymbol::drawSymbol(
239  QPainter* painter, const QPointF& pos ) const
240 {
241  drawSymbols( painter, &pos, 1 );
242 }
243 
252  QPainter* painter, const QPolygonF& points ) const
253 {
254  drawSymbols( painter, points.data(), points.size() );
255 }
256 
257 #endif
QwtSymbol::HLine
@ HLine
Horizontal line.
Definition: qwt_symbol.h:74
QwtSymbol::Triangle
@ Triangle
Triangle pointing upwards.
Definition: qwt_symbol.h:53
QwtSymbol::Cache
@ Cache
Always use a pixmap cache.
Definition: qwt_symbol.h:156
QwtSymbol::drawSymbols
void drawSymbols(QPainter *, const QPolygonF &) const
Draw symbols at the specified points.
Definition: qwt_symbol.h:251
QwtGraphic
A paint device for scalable graphics.
Definition: qwt_graphic.h:75
QwtSymbol::Style
Style
Definition: qwt_symbol.h:38
QwtSymbol::DTriangle
@ DTriangle
Triangle pointing downwards.
Definition: qwt_symbol.h:56
qwt_global.h
QwtSymbol::PrivateData
Definition: qwt_symbol.cpp:770
QwtSymbol::Graphic
@ Graphic
Definition: qwt_symbol.h:111
nonstd::span_lite::size
span_constexpr std::size_t size(span< T, Extent > const &spn)
Definition: span.hpp:1554
QwtSymbol::SvgDocument
@ SvgDocument
Definition: qwt_symbol.h:119
QwtSymbol
A class for drawing symbols.
Definition: qwt_symbol.h:31
QwtSymbol::RTriangle
@ RTriangle
Triangle pointing right.
Definition: qwt_symbol.h:65
QwtSymbol::Ellipse
@ Ellipse
Ellipse or circle.
Definition: qwt_symbol.h:44
sol::meta::enable
std::enable_if_t< all< Args... >::value, enable_t > enable
Definition: sol.hpp:2244
QwtSymbol::Diamond
@ Diamond
Diamond.
Definition: qwt_symbol.h:50
QwtSymbol::UTriangle
@ UTriangle
Triangle pointing upwards.
Definition: qwt_symbol.h:59
QwtSymbol::VLine
@ VLine
Vertical line.
Definition: qwt_symbol.h:77
QwtSymbol::XCross
@ XCross
Diagonal cross (X)
Definition: qwt_symbol.h:71
QwtSymbol::Star1
@ Star1
X combined with +.
Definition: qwt_symbol.h:80
QwtSymbol::NoCache
@ NoCache
Don't use a pixmap cache.
Definition: qwt_symbol.h:153
QwtSymbol::LTriangle
@ LTriangle
Triangle pointing left.
Definition: qwt_symbol.h:62
QWT_EXPORT
#define QWT_EXPORT
Definition: qwt_global.h:38
QwtSymbol::Rect
@ Rect
Rectangle.
Definition: qwt_symbol.h:47
QwtSymbol::Hexagon
@ Hexagon
Hexagon.
Definition: qwt_symbol.h:86
QwtSymbol::CachePolicy
CachePolicy
Definition: qwt_symbol.h:150
QwtSymbol::Star2
@ Star2
Six-pointed star.
Definition: qwt_symbol.h:83
QwtSymbol::Pixmap
@ Pixmap
Definition: qwt_symbol.h:103
QwtSymbol::Cross
@ Cross
Cross (+)
Definition: qwt_symbol.h:68
QwtSymbol::Path
@ Path
Definition: qwt_symbol.h:95


plotjuggler
Author(s): Davide Faconti
autogenerated on Mon Nov 11 2024 03:23:46