mirror of
https://gitlab.com/pholy/OSCAR-code.git
synced 2025-04-15 10:10:45 +00:00
Use UTC when converting to QDateTime for graph axis
QDateTime::fromMSecsSinceEpoch returns a QDateTime in the local time zone, but the ms input was created in UTC. This causes the day part to sometimes display off by a day on the graph x axis. This appears to be caused by a breaking change in QT 5. Previously, fromMSecsSinceEpoch returned a QDateTime in UTC, but in QT 5, it returns the date time in the local time zone.
This commit is contained in:
parent
b5e92c9c49
commit
b0bc8af718
@ -397,8 +397,10 @@ void gXAxisDay::paint(QPainter &painter, gGraph &graph, const QRegion ®ion)
|
|||||||
minx = graph.min_x;
|
minx = graph.min_x;
|
||||||
maxx = graph.max_x;
|
maxx = graph.max_x;
|
||||||
|
|
||||||
QDateTime date2 = QDateTime::fromMSecsSinceEpoch(minx);
|
QDateTime date2 = QDateTime::fromMSecsSinceEpoch(minx, Qt::UTC);
|
||||||
QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(maxx);
|
QDateTime enddate2 = QDateTime::fromMSecsSinceEpoch(maxx, Qt::UTC);
|
||||||
|
|
||||||
|
qInfo() << "Drawing date axis from " << date2 << " to " << enddate2;
|
||||||
|
|
||||||
QDate date = date2.date();
|
QDate date = date2.date();
|
||||||
// QDate enddate = enddate2.date();
|
// QDate enddate = enddate2.date();
|
||||||
|
Loading…
Reference in New Issue
Block a user