PieView: Add reset function

On treeWidget->clear() non of the the existing functions got called so
the total doubled with every refresh
This commit is contained in:
ballessay 2017-04-26 01:31:51 +02:00 committed by C. Balles
parent 06e82c8421
commit d45c253f9f
2 changed files with 14 additions and 3 deletions

View File

@ -65,6 +65,14 @@ PieView::PieView(QWidget *parent)
rubberBand = 0;
}
void PieView::reset()
{
validItems = 0;
totalValue = 0.0;
QAbstractItemView::reset();
}
void PieView::dataChanged(const QModelIndex &topLeft,
const QModelIndex &bottomRight,
const QVector<int> &)

View File

@ -55,11 +55,14 @@ public:
void scrollTo(const QModelIndex &index, ScrollHint hint = EnsureVisible);
QModelIndex indexAt(const QPoint &point) const;
public slots:
void reset() override;
protected slots:
void dataChanged(const QModelIndex &topLeft, const QModelIndex &bottomRight,
const QVector<int> &roles = QVector<int>());
void rowsInserted(const QModelIndex &parent, int start, int end);
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end);
const QVector<int> &roles = QVector<int>()) override;
void rowsInserted(const QModelIndex &parent, int start, int end) override;
void rowsAboutToBeRemoved(const QModelIndex &parent, int start, int end) override;
protected:
bool edit(const QModelIndex &index, EditTrigger trigger, QEvent *event);