source: src/gui/dayviewtabcontainer.cpp @ 809b5e5

qt5
Last change on this file since 809b5e5 was de5d0f1, checked in by gregor herrmann <gregoa@…>, 5 years ago

Bump copyright years.

  • Property mode set to 100644
File size: 2.0 KB
Line 
1/*
2 * Copyright (C) 2010 Ixonos Plc.
3 * Copyright (C) 2011-2017 Philipp Spitzer, gregor herrmann, Stefan Stahl
4 *
5 * This file is part of ConfClerk.
6 *
7 * ConfClerk is free software: you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the Free
9 * Software Foundation, either version 2 of the License, or (at your option)
10 * any later version.
11 *
12 * ConfClerk is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
15 * more details.
16 *
17 * You should have received a copy of the GNU General Public License along with
18 * ConfClerk.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21#include "dayviewtabcontainer.h"
22
23DayViewTabContainer::DayViewTabContainer(QWidget *aParent): TabContainer(aParent) {
24}
25
26
27void DayViewTabContainer::expandTimeGroup(QTime time, int conferenceId) {
28    EventModel* eventModel = static_cast<EventModel*>(treeView->model());
29
30    // iterate over the time groups
31    for (int g = 0; g != eventModel->rowCount(); ++g) {
32        QModelIndex groupIdx = eventModel->index(g, 0);
33        // iterate over the events in the group
34        for (int e = 0; e != eventModel->rowCount(groupIdx); ++e) {
35            QModelIndex eventIdx = eventModel->index(e, 0, groupIdx);
36            int eventId = eventIdx.data().toInt();
37            Event event = Event::getById(eventId, conferenceId);
38            if (time < event.start().time().addSecs(event.duration())) { // if time < end
39                // expand this group
40                treeView->expand(groupIdx);
41                treeView->scrollTo(eventIdx, QAbstractItemView::PositionAtTop);
42                return;
43            }
44        }
45    }
46}
47
48
49void DayViewTabContainer::loadEvents( const QDate &aDate, const int aConferenceId ) {
50    static_cast<EventModel*>(treeView->model())->loadEvents( aDate, aConferenceId );
51}
Note: See TracBrowser for help on using the repository browser.