dataChanged() - so 'TreeView' know it has to redraw items
corresponding to chanded indices (range of indeces)
createTimeGroups();
}
+void EventModel::emitDataChangedSignal(const QModelIndex &aTopLeft, const QModelIndex &aBottomRight)
+{
+ emit(dataChanged(aTopLeft,aBottomRight));
+}
+
int rowCount ( const QModelIndex & parent = QModelIndex() ) const;
void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB
+
+ // a method to force 'EventModel' emit signal 'dataChanged()'
+ // a 'view', eg. 'TreeView' listens for this signal and redraws changed items(indexes)
+ void emitDataChangedSignal(const QModelIndex &aTopLeft, const QModelIndex &aBottomRight);
private:
struct Group
#include "treeview.h"
#include "delegate.h"
#include "event.h"
+#include "eventmodel.h"
#include <QDebug>
}
qDebug() << " FAVOURITE [" << qVariantValue<QString>(aIndex.data()) << "] -> " << event.isFavourite();
event.update("favourite");
- // TODO: since the Favourite icon has changed, update TreeView accordingly
- // not really working solution is the following
- // maybe the call to MainWindow->update() fix the problem ???
- QTreeView::update();
- update();
+ // since the Favourite icon has changed, update TreeView accordingly
+ static_cast<EventModel*>(model())->emitDataChangedSignal(aIndex,aIndex);
}
break;
case Delegate::AlarmControlOn: