Ignore:
Timestamp:
01/21/10 23:03:07 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
d336730
Parents:
1735f55
Message:

EventModel? signaling changed

  • if some of the data (favourite,alarm) has changed on the event, signal 'eventHasChanged' is emitted
  • all treeViews (eg. DayView?, FavsView?, TracksView?, ...) have to listen on this signal

Only favouritiesView is 'reset' when current tab is changed in mainWindow

  • 'cause time groupings have to be recreated, since favs may have changed
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/eventmodel.cpp

    r1735f55 rc718a77  
    11#include "eventmodel.h"
     2#include <appsettings.h>
    23#include <conference.h>
    34#include <track.h>
     
    220221}
    221222
    222 void EventModel::emitDataChangedSignal(const QModelIndex &aTopLeft, const QModelIndex &aBottomRight)
    223 {
    224     emit(dataChanged(aTopLeft,aBottomRight));
    225 }
    226 
     223void EventModel::updateModel(int aEventId)
     224{
     225    for(int i=0; i<mEvents.count(); i++)
     226    {
     227        if(mEvents[i].id() == aEventId)
     228            mEvents[i] = Event::getById(aEventId,AppSettings::confId());
     229    }
     230
     231    // find the ModelIndex for given aEventId
     232    for(int i=0; i<mGroups.count(); i++)
     233    {
     234        QModelIndex groupIndex = index(i,0,QModelIndex());
     235        for(int j=0; j<mGroups[i].mChildCount; j++)
     236        {
     237            QModelIndex eventIndex = index(j,0,groupIndex);
     238            if(static_cast<Event*>(eventIndex.internalPointer())->id() == aEventId)
     239            {
     240                emit(dataChanged(eventIndex,eventIndex));
     241            }
     242        }
     243    }
     244}
     245
Note: See TracChangeset for help on using the changeset viewer.