QWT API (中文) 7.3.0
Qt绘图库 - 中文API文档
载入中...
搜索中...
未找到
qwt_date.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 * Modified by ChenZongYan in 2024 <czy.t@163.com>
10 * Summary of major modifications (see ChangeLog.md for full history):
11 * 1. CMake build system & C++11 throughout.
12 * 2. Core panner/ zoomer refactored:
13 * - QwtPanner → QwtCachePanner (pixmap-cache version)
14 * - New real-time QwtPlotPanner derived from QwtPicker.
15 * 3. Zoomer supports multi-axis.
16 * 4. Parasite-plot framework:
17 * - QwtFigure, QwtPlotParasiteLayout, QwtPlotTransparentCanvas,
18 * - QwtPlotScaleEventDispatcher, built-in pan/zoom on axis.
19 * 5. New picker: QwtPlotSeriesDataPicker (works with date axis).
20 * 6. Raster & color-map extensions:
21 * - QwtGridRasterData (2-D table + interpolation)
22 * - QwtLinearColorMap::stopColors(), stopPos() API rename.
23 * 7. Bar-chart: expose pen/brush control.
24 * 8. Amalgamated build: single QwtPlot.h / QwtPlot.cpp pair in src-amalgamate.
25 *****************************************************************************/
26
27#ifndef QWT_DATE_H
28#define QWT_DATE_H
29
30#include "qwtcore_global.h"
31#include <qdatetime.h>
32#include <QTimeZone>
33
61class QWTCORE_EXPORT QwtDate
62{
63public:
68 {
76
81 FirstDay
82 };
83
91 {
94
97
100
103
106
109
112
114 Year
115 };
116
117 enum
118 {
120 JulianDayForEpoch = 2440588
121 };
122
123 // Get minimum date
124 static QDate minDate();
125 // Get maximum date
126 static QDate maxDate();
127
128 // Convert Qt::TimeSpec to QTimeZone
129 static QTimeZone toTimeZone(Qt::TimeSpec timeSpec, int offsetSeconds = 0);
130
131 // Convert double to QDateTime
132 static QDateTime toDateTime(double value, Qt::TimeSpec = Qt::UTC);
133
134 // Convert double to QDateTime with a specific time zone
135 static QDateTime toDateTime(double value, const QTimeZone& timeZone);
136
137 // Convert QDateTime to double
138 static double toDouble(const QDateTime&);
139
140 // Ceil datetime to interval type
141 static QDateTime ceil(const QDateTime&, IntervalType);
142 // Floor datetime to interval type
143 static QDateTime floor(const QDateTime&, IntervalType);
144
145 // Get date of week 0
146 static QDate dateOfWeek0(int year, Week0Type);
147 // Get week number
148 static int weekNumber(const QDate&, Week0Type);
149
150 // Get UTC offset in seconds
151 static int utcOffset(const QDateTime&);
152
153 // Format datetime to string
154 static QString toString(const QDateTime&, const QString& format, Week0Type);
155};
156
157#endif
A collection of methods around date/time values
Definition qwt_date.h:62
Week0Type
How to identify the first week of year differs between countries
Definition qwt_date.h:68
@ FirstThursday
Definition qwt_date.h:75
IntervalType
Classification of a time interval
Definition qwt_date.h:91
@ Month
Month
Definition qwt_date.h:111
@ Day
Day
Definition qwt_date.h:105
@ Millisecond
Millisecond
Definition qwt_date.h:93
@ Minute
Minute
Definition qwt_date.h:99
@ Hour
Hour
Definition qwt_date.h:102
@ Second
Second
Definition qwt_date.h:96
@ Week
Week
Definition qwt_date.h:108