Take display time shift into account when expanding a group in the day view tab.
authorgregor herrmann <gregor@toastfreeware.priv.at>
Thu, 19 Aug 2021 13:30:28 +0000 (15:30 +0200)
committergregor herrmann <gregor@toastfreeware.priv.at>
Thu, 19 Aug 2021 13:30:28 +0000 (15:30 +0200)
src/gui/dayviewtabcontainer.cpp

index 8b067164fee321dfc0a0cf0f67e70de9f760a184..5427fd88f569955c75fc97223c37d83496416ce9 100644 (file)
@@ -26,6 +26,7 @@ DayViewTabContainer::DayViewTabContainer(QWidget *aParent): TabContainer(aParent
 
 void DayViewTabContainer::expandTimeGroup(QTime time, int conferenceId) {
     EventModel* eventModel = static_cast<EventModel*>(treeView->model());
+    Conference conference = Conference::getById(conferenceId);
 
     // iterate over the time groups
     for (int g = 0; g != eventModel->rowCount(); ++g) {
@@ -35,7 +36,9 @@ void DayViewTabContainer::expandTimeGroup(QTime time, int conferenceId) {
             QModelIndex eventIdx = eventModel->index(e, 0, groupIdx);
             int eventId = eventIdx.data().toInt();
             Event event = Event::getById(eventId, conferenceId);
-            if (time < event.start().time().addSecs(event.duration())) { // if time < end
+            QDateTime eventStart = event.start();
+            if (conference.hasDisplayTimeShift()) eventStart = eventStart.addSecs(conference.displayTimeShift() * 60);
+            if (time < eventStart.time().addSecs(event.duration())) { // if time < end
                 // expand this group
                 treeView->expand(groupIdx);
                 treeView->scrollTo(eventIdx, QAbstractItemView::PositionAtTop);