qwt_date_scale_draw.h 2.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  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_DATE_SCALE_DRAW_H_
  10. #define _QWT_DATE_SCALE_DRAW_H_ 1
  11. #include "qwt_global.h"
  12. #include "qwt_scale_draw.h"
  13. #include "qwt_date.h"
  14. /*!
  15. \brief A class for drawing datetime scales
  16. QwtDateScaleDraw displays values as datetime labels.
  17. The format of the labels depends on the alignment of
  18. the major tick labels.
  19. The default format strings are:
  20. - Millisecond\n
  21. "hh:mm:ss:zzz\nddd dd MMM yyyy"
  22. - Second\n
  23. "hh:mm:ss\nddd dd MMM yyyy"
  24. - Minute\n
  25. "hh:mm\nddd dd MMM yyyy"
  26. - Hour\n
  27. "hh:mm\nddd dd MMM yyyy"
  28. - Day\n
  29. "ddd dd MMM yyyy"
  30. - Week\n
  31. "Www yyyy"
  32. - Month\n
  33. "MMM yyyy"
  34. - Year\n
  35. "yyyy"
  36. The format strings can be modified using setDateFormat()
  37. or individually for each tick label by overloading dateFormatOfDate(),
  38. Usually QwtDateScaleDraw is used in combination with
  39. QwtDateScaleEngine, that calculates scales for datetime
  40. intervals.
  41. \sa QwtDateScaleEngine, QwtPlot::setAxisScaleDraw()
  42. */
  43. class QWT_EXPORT QwtDateScaleDraw: public QwtScaleDraw
  44. {
  45. public:
  46. QwtDateScaleDraw( Qt::TimeSpec = Qt::LocalTime );
  47. virtual ~QwtDateScaleDraw();
  48. void setDateFormat( QwtDate::IntervalType, const QString & );
  49. QString dateFormat( QwtDate::IntervalType ) const;
  50. void setTimeSpec( Qt::TimeSpec );
  51. Qt::TimeSpec timeSpec() const;
  52. void setUtcOffset( int seconds );
  53. int utcOffset() const;
  54. void setWeek0Type( QwtDate::Week0Type );
  55. QwtDate::Week0Type week0Type() const;
  56. virtual QwtText label( double ) const;
  57. QDateTime toDateTime( double ) const;
  58. protected:
  59. virtual QwtDate::IntervalType
  60. intervalType( const QwtScaleDiv & ) const;
  61. virtual QString dateFormatOfDate( const QDateTime &,
  62. QwtDate::IntervalType ) const;
  63. private:
  64. class PrivateData;
  65. PrivateData *d_data;
  66. };
  67. #endif