diff data/model/SparseOneDimensionalModel.h @ 425:f5e8f12d2e58

* Add audio device selection to preferences * Add (not yet functional) insert, delete, edit buttons to data edit window * Add proper set methods for time fields in data edit window (using general sparse model base class)
author Chris Cannam
date Fri, 13 Jun 2008 21:09:43 +0000
parents eafef13bb0b3
children 72ec275e458b
line wrap: on
line diff
--- a/data/model/SparseOneDimensionalModel.h	Thu Jun 12 14:33:45 2008 +0000
+++ b/data/model/SparseOneDimensionalModel.h	Fri Jun 13 21:09:43 2008 +0000
@@ -132,16 +132,15 @@
 
     virtual QVariant getData(int row, int column, int role) const
     {
+        if (column < 2) {
+            return SparseModel<OneDimensionalPoint>::getData
+                (row, column, role);
+        }
+
         PointListIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return QVariant();
 
         switch (column) {
-        case 0: {
-            if (role == SortRole) return int(i->frame);
-            RealTime rt = RealTime::frame2RealTime(i->frame, getSampleRate());
-            return QVariant(rt.toText().c_str());
-        }
-        case 1: return int(i->frame);
         case 2: return i->label;
         default: return QVariant();
         }
@@ -149,6 +148,11 @@
 
     virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role)
     {
+        if (column < 2) {
+            return SparseModel<OneDimensionalPoint>::getSetDataCommand
+                (row, column, value, role);
+        }
+
         if (role != Qt::EditRole) return false;
         PointListIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return false;
@@ -158,7 +162,6 @@
         command->deletePoint(point);
 
         switch (column) {
-        case 0: case 1: point.frame = value.toInt(); break; 
         case 2: point.label = value.toString(); break;
         }