Qwt User's Guide  6.1.1
 All Classes Functions Variables Typedefs Enumerations Enumerator Pages
qwt_plot_grid.h
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_GRID_H
11 #define QWT_PLOT_GRID_H
12 
13 #include "qwt_global.h"
14 #include "qwt_plot_item.h"
15 #include "qwt_scale_div.h"
16 
17 class QPainter;
18 class QPen;
19 class QwtScaleMap;
20 class QwtScaleDiv;
21 
34 class QWT_EXPORT QwtPlotGrid: public QwtPlotItem
35 {
36 public:
37  explicit QwtPlotGrid();
38  virtual ~QwtPlotGrid();
39 
40  virtual int rtti() const;
41 
42  void enableX( bool tf );
43  bool xEnabled() const;
44 
45  void enableY( bool tf );
46  bool yEnabled() const;
47 
48  void enableXMin( bool tf );
49  bool xMinEnabled() const;
50 
51  void enableYMin( bool tf );
52  bool yMinEnabled() const;
53 
54  void setXDiv( const QwtScaleDiv &sx );
55  const QwtScaleDiv &xScaleDiv() const;
56 
57  void setYDiv( const QwtScaleDiv &sy );
58  const QwtScaleDiv &yScaleDiv() const;
59 
60  void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
61  void setPen( const QPen & );
62 
63  void setMajorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
64  void setMajorPen( const QPen & );
65  const QPen& majorPen() const;
66 
67  void setMinorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
68  void setMinorPen( const QPen &p );
69  const QPen& minorPen() const;
70 
71  virtual void draw( QPainter *p,
72  const QwtScaleMap &xMap, const QwtScaleMap &yMap,
73  const QRectF &rect ) const;
74 
75  virtual void updateScaleDiv(
76  const QwtScaleDiv &xMap, const QwtScaleDiv &yMap );
77 
78 private:
79  void drawLines( QPainter *painter, const QRectF &,
80  Qt::Orientation orientation, const QwtScaleMap &,
81  const QList<double> & ) const;
82 
83  class PrivateData;
84  PrivateData *d_data;
85 };
86 
87 #endif
virtual void draw(QPainter *painter, const QwtScaleMap &xMap, const QwtScaleMap &yMap, const QRectF &canvasRect) const =0
Draw the item.
Base class for items on the plot canvas.
Definition: qwt_plot_item.h:64
A scale map.
Definition: qwt_scale_map.h:30
virtual int rtti() const
Definition: qwt_plot_item.cpp:120
A class representing a scale division.
Definition: qwt_scale_div.h:36
A class which draws a coordinate grid.
Definition: qwt_plot_grid.h:34
virtual void updateScaleDiv(const QwtScaleDiv &, const QwtScaleDiv &)
Update the item to changes of the axes scale division.
Definition: qwt_plot_item.cpp:636