Fix plotting with datetimes on x axis (#738)

Use QDateTime::toMSecsSinceEpoch() instead of
deprecated QDateTime::toTime_t() which does not
correctly convert datetimes which do not exist
due to switch to Daylight Saving Time
This commit is contained in:
Oleg Prutz
2017-03-05 16:17:26 +03:00
parent 8ac4c0342a
commit 84a5030d9e

View File

@@ -201,7 +201,7 @@ void PlotDock::updatePlot(SqliteTableModel* model, BrowseDataTableSettings* sett
{
QString s = model->data(model->index(i, x)).toString();
QDateTime d = QDateTime::fromString(s, Qt::ISODate);
xdata[i] = d.toTime_t();
xdata[i] = d.toMSecsSinceEpoch() / 1000.0;
} else {
// Get the x value for this point. If the selected column is -1, i.e. the row number, just use the current row number from the loop
// instead of retrieving some value from the model.