Clear the data when the model resets.

This patch does a few things:
1 - reset the model when user closes the dive file
2 - connects the 'rowsAboutToBeRemoved' in a way that the graphics can
    remove their polygons too
3 - adds a 'clear' virtual method so items that don't follow the rules can
    clean themseves up.

Signed-off-by: Tomaz Canabrava <tcanabrava@kde.org>
Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Tomaz Canabrava 2014-02-10 14:41:59 -02:00 committed by Dirk Hohndel
parent 2f2c9e371c
commit cafc7e4b13
5 changed files with 23 additions and 0 deletions

View file

@ -41,9 +41,11 @@ public:
void setHorizontalDataColumn(int column);
void setVerticalDataColumn(int column);
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0) = 0;
virtual void clear(){};
public slots:
virtual void preferencesChanged();
virtual void modelDataChanged(const QModelIndex& topLeft = QModelIndex(), const QModelIndex& bottomRight = QModelIndex());
virtual void modelDataRemoved(const QModelIndex& parent, int from, int to);
protected:
/* when the model emits a 'datachanged' signal, this method below should be used to check if the
* modified data affects this particular item ( for example, when setting the '3m increment'