qwt_plot_grid.h 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. #ifndef QWT_PLOT_GRID_H
  10. #define QWT_PLOT_GRID_H
  11. #include "qwt_global.h"
  12. #include "qwt_plot_item.h"
  13. #include "qwt_scale_div.h"
  14. class QPainter;
  15. class QPen;
  16. class QwtScaleMap;
  17. class QwtScaleDiv;
  18. /*!
  19. \brief A class which draws a coordinate grid
  20. The QwtPlotGrid class can be used to draw a coordinate grid.
  21. A coordinate grid consists of major and minor vertical
  22. and horizontal grid lines. The locations of the grid lines
  23. are determined by the X and Y scale divisions which can
  24. be assigned with setXDiv() and setYDiv().
  25. The draw() member draws the grid within a bounding
  26. rectangle.
  27. */
  28. class QWT_EXPORT QwtPlotGrid: public QwtPlotItem
  29. {
  30. public:
  31. explicit QwtPlotGrid();
  32. virtual ~QwtPlotGrid();
  33. virtual int rtti() const;
  34. void enableX( bool );
  35. bool xEnabled() const;
  36. void enableY( bool );
  37. bool yEnabled() const;
  38. void enableXMin( bool );
  39. bool xMinEnabled() const;
  40. void enableYMin( bool );
  41. bool yMinEnabled() const;
  42. void setXDiv( const QwtScaleDiv & );
  43. const QwtScaleDiv &xScaleDiv() const;
  44. void setYDiv( const QwtScaleDiv & );
  45. const QwtScaleDiv &yScaleDiv() const;
  46. void setPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
  47. void setPen( const QPen & );
  48. void setMajorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
  49. void setMajorPen( const QPen & );
  50. const QPen& majorPen() const;
  51. void setMinorPen( const QColor &, qreal width = 0.0, Qt::PenStyle = Qt::SolidLine );
  52. void setMinorPen( const QPen & );
  53. const QPen& minorPen() const;
  54. virtual void draw( QPainter *,
  55. const QwtScaleMap &xMap, const QwtScaleMap &yMap,
  56. const QRectF &canvasRect ) const;
  57. virtual void updateScaleDiv(
  58. const QwtScaleDiv &xScaleDiv, const QwtScaleDiv &yScaleDiv );
  59. private:
  60. void drawLines( QPainter *, const QRectF &,
  61. Qt::Orientation, const QwtScaleMap &,
  62. const QList<double> & ) const;
  63. class PrivateData;
  64. PrivateData *d_data;
  65. };
  66. #endif