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