Ignore:
Timestamp:
10/17/11 23:37:48 (11 years ago)
Author:
Philipp Spitzer <philipp@…>
Branches:
master, qt5
Children:
9196cb0
Parents:
066b41f
Message:

Implemented "now" action and removed the "now" button from the day navigator.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/gui/dayviewtabcontainer.cpp

    r066b41f r11d7ec5  
    2121#include "dayviewtabcontainer.h"
    2222
    23 DayViewTabContainer::DayViewTabContainer(QWidget *aParent) : TabContainer( aParent )
    24 {
     23DayViewTabContainer::DayViewTabContainer(QWidget *aParent): TabContainer(aParent) {
    2524}
    2625
    27 DayViewTabContainer::~DayViewTabContainer()
    28 {
     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    }
    2946}
    3047
    31 void DayViewTabContainer::loadEvents( const QDate &aDate, const int aConferenceId )
    32 {
     48
     49void DayViewTabContainer::loadEvents( const QDate &aDate, const int aConferenceId ) {
    3350    static_cast<EventModel*>(treeView->model())->loadEvents( aDate, aConferenceId );
    3451}
Note: See TracChangeset for help on using the changeset viewer.