Mercurial > hg > svcore
diff data/model/SparseModel.h @ 427:72ec275e458b
* Basic implementation of add and remove point in data editor
* Improve resilience of frame - real-time - frame round-trip conversions
author | Chris Cannam |
---|---|
date | Mon, 16 Jun 2008 14:48:42 +0000 |
parents | f5e8f12d2e58 |
children | 113cf8781bd1 |
line wrap: on
line diff
--- a/data/model/SparseModel.h Mon Jun 16 07:55:35 2008 +0000 +++ b/data/model/SparseModel.h Mon Jun 16 14:48:42 2008 +0000 @@ -307,6 +307,7 @@ return QVariant(); } + virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) { @@ -327,6 +328,26 @@ return command->finish(); } + virtual Command *getInsertRowCommand(int row) + { + EditCommand *command = new EditCommand(this, tr("Insert Data Point")); + Point point(0); + PointListIterator i = getPointListIteratorForRow(row); + if (i == m_points.end() && i != m_points.begin()) --i; + if (i != m_points.end()) point = *i; + command->addPoint(point); + return command->finish(); + } + + virtual Command *getRemoveRowCommand(int row) + { + EditCommand *command = new EditCommand(this, tr("Delete Data Point")); + PointListIterator i = getPointListIteratorForRow(row); + if (i == m_points.end()) return 0; + command->deletePoint(*i); + return command->finish(); + } + protected: size_t m_sampleRate; size_t m_resolution;