Commit 35233eeb authored by Volker Krause's avatar Volker Krause

Draw time labels based on the selected range, not today's date

This makes a difference for out-of-sync DST changes like they happen
between Europe and the US. The displayed times are still (partially)
wrong when selecting a range that overlaps a DST change, but that is
a far smaller issue.
parent af87c91b
......@@ -181,11 +181,12 @@ void TimeLabels::paintEvent(QPaintEvent *)
// We won't paint parts that aren't visible
const int cy = -y();// y() returns a negative value.
const auto firstDay = QDateTime(mAgenda->dateList().first(), QTime(0,0,0), Qt::LocalTime).toUTC();
const int beginning =
!mTimezone.isValid() ?
0 :
(mTimezone.offsetFromUtc(QDateTime::currentDateTimeUtc()) -
mTimeLabelsZone->preferences()->timeZone().offsetFromUtc(QDateTime::currentDateTimeUtc())) / (60 * 60);
(mTimezone.offsetFromUtc(firstDay) -
mTimeLabelsZone->preferences()->timeZone().offsetFromUtc(firstDay)) / (60 * 60);
// bug: the parameters cx and cw are the areas that need to be
// redrawn, not the area of the widget. unfortunately, this
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment