diff data/model/ImageModel.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 d7f3dfe6f9a4
line wrap: on
line diff
--- a/data/model/ImageModel.h	Thu Jun 12 14:33:45 2008 +0000
+++ b/data/model/ImageModel.h	Fri Jun 13 21:09:43 2008 +0000
@@ -159,16 +159,15 @@
 
     virtual QVariant getData(int row, int column, int role) const
     {
+        if (column < 2) {
+            return SparseModel<ImagePoint>::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 rt.toText().c_str();
-        }
-        case 1: return int(i->frame);
         case 2: return i->image;
         case 3: return i->label;
         default: return QVariant();
@@ -177,6 +176,11 @@
 
     virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role)
     {
+        if (column < 2) {
+            return SparseModel<ImagePoint>::getSetDataCommand
+                (row, column, value, role);
+        }
+
         if (role != Qt::EditRole) return false;
         PointListIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return false;
@@ -186,7 +190,6 @@
         command->deletePoint(point);
 
         switch (column) {
-        case 0: case 1: point.frame = value.toInt(); break; 
         case 2: point.image = value.toString(); break;
         case 3: point.label = value.toString(); break;
         }