#1800 Ensure auto-scaling of QWT plots with date scale and week resolution will not miss points in the upper end of the plot

This commit is contained in:
Bjørnar Grip Fjær 2017-08-22 11:08:39 +02:00
parent 86365357f4
commit 46919b463d

View File

@ -1170,7 +1170,17 @@ QDateTime QwtDateScaleEngine::alignDate(
const QDate date = QwtDate::dateOfWeek0(
dt.date().year(), d_data->week0Type );
const int numWeeks = date.daysTo( dt.date() ) / 7;
// Manually patched from QWT trunk
int numWeeks = date.daysTo( dt.date() ) / 7;
if (up)
{
if (dt.time() > QTime(0, 0) ||
date.daysTo(dt.date()) % 7)
{
numWeeks++;
}
}
const int d = qwtAlignValue( numWeeks, stepSize, up ) * 7;
dt = QwtDate::floor( dt, QwtDate::Day );