Changeset 67c59a7


Ignore:
Timestamp:
01/17/10 20:31:04 (12 years ago)
Author:
pavelpa <pavelpa@…>
Branches:
master, qt5
Children:
9f7666d
Parents:
2af8e2f
Message:

implemented method to force 'EventModel?' emit a signal
dataChanged() - so 'TreeView?' know it has to redraw items
corresponding to chanded indices (range of indeces)

Location:
src/mvc
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/mvc/eventmodel.cpp

    r2af8e2f r67c59a7  
    144144}
    145145
     146void EventModel::emitDataChangedSignal(const QModelIndex &aTopLeft, const QModelIndex &aBottomRight)
     147{
     148    emit(dataChanged(aTopLeft,aBottomRight));
     149}
     150
  • src/mvc/eventmodel.h

    r2af8e2f r67c59a7  
    1717    void loadEvents(const QDate &aDate, int aConferenceId); // loads Events from the DB
    1818    void loadFavEvents(const QDate &aDate, int aConferenceId); // loads Favourite events from the DB
     19   
     20    // a method to force 'EventModel' emit signal 'dataChanged()'
     21    // a 'view', eg. 'TreeView' listens for this signal and redraws changed items(indexes)
     22    void emitDataChangedSignal(const QModelIndex &aTopLeft, const QModelIndex &aBottomRight);
    1923
    2024private:
  • src/mvc/treeview.cpp

    r2af8e2f r67c59a7  
    44#include "delegate.h"
    55#include "event.h"
     6#include "eventmodel.h"
    67
    78#include <QDebug>
     
    4950                qDebug() << " FAVOURITE [" << qVariantValue<QString>(aIndex.data()) << "] -> " << event.isFavourite();
    5051                event.update("favourite");
    51                 // TODO: since the Favourite icon has changed, update TreeView accordingly
    52                 // not really working solution is the following
    53                 // maybe the call to MainWindow->update() fix the problem ???
    54                 QTreeView::update();
    55                 update();
     52                // since the Favourite icon has changed, update TreeView accordingly
     53                static_cast<EventModel*>(model())->emitDataChangedSignal(aIndex,aIndex);
    5654            }
    5755            break;
Note: See TracChangeset for help on using the changeset viewer.