Qwt User's Guide  6.2.0
qwt_plot_marker.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_MARKER_H
11 #define QWT_PLOT_MARKER_H
12 
13 #include "qwt_global.h"
14 #include "qwt_plot_item.h"
15 
16 class QString;
17 class QRectF;
18 class QwtText;
19 class QwtSymbol;
20 
45 class QWT_EXPORT QwtPlotMarker : public QwtPlotItem
46 {
47  public:
48 
53  enum LineStyle
54  {
57 
60 
63 
65  Cross
66  };
67 
68  explicit QwtPlotMarker();
69  explicit QwtPlotMarker( const QString& title );
70  explicit QwtPlotMarker( const QwtText& title );
71 
72  virtual ~QwtPlotMarker();
73 
74  virtual int rtti() const QWT_OVERRIDE;
75 
76  double xValue() const;
77  double yValue() const;
78  QPointF value() const;
79 
80  void setXValue( double );
81  void setYValue( double );
82  void setValue( double, double );
83  void setValue( const QPointF& );
84 
85  void setLineStyle( LineStyle );
86  LineStyle lineStyle() const;
87 
88  void setLinePen( const QColor&, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
89  void setLinePen( const QPen& );
90  const QPen& linePen() const;
91 
92  void setSymbol( const QwtSymbol* );
93  const QwtSymbol* symbol() const;
94 
95  void setLabel( const QwtText& );
96  QwtText label() const;
97 
98  void setLabelAlignment( Qt::Alignment );
99  Qt::Alignment labelAlignment() const;
100 
101  void setLabelOrientation( Qt::Orientation );
102  Qt::Orientation labelOrientation() const;
103 
104  void setSpacing( int );
105  int spacing() const;
106 
107  virtual void draw( QPainter*,
108  const QwtScaleMap& xMap, const QwtScaleMap& yMap,
109  const QRectF& ) const QWT_OVERRIDE;
110 
111  virtual QRectF boundingRect() const QWT_OVERRIDE;
112 
113  virtual QwtGraphic legendIcon(
114  int index, const QSizeF& ) const QWT_OVERRIDE;
115 
116  protected:
117  virtual void drawLines( QPainter*,
118  const QRectF&, const QPointF& ) const;
119 
120  virtual void drawSymbol( QPainter*,
121  const QRectF&, const QPointF& ) const;
122 
123  virtual void drawLabel( QPainter*,
124  const QRectF&, const QPointF& ) const;
125 
126  private:
127 
128  class PrivateData;
129  PrivateData* m_data;
130 };
131 
132 #endif
A paint device for scalable graphics.
Definition: qwt_graphic.h:76
Base class for items on the plot canvas.
Definition: qwt_plot_item.h:67
virtual int rtti() const
A class for drawing markers.
@ HLine
A horizontal line.
@ NoLine
No line.
@ VLine
A vertical line.
A scale map.
Definition: qwt_scale_map.h:27
A class for drawing symbols.
Definition: qwt_symbol.h:32
A class representing a text.
Definition: qwt_text.h:52