diff data/model/SparseTimeValueModel.h @ 424:eafef13bb0b3

* Add more data-editor support to various models
author Chris Cannam
date Thu, 12 Jun 2008 14:33:45 +0000
parents 6a96bff0bd59
children f5e8f12d2e58
line wrap: on
line diff
--- a/data/model/SparseTimeValueModel.h	Thu Jun 12 10:47:11 2008 +0000
+++ b/data/model/SparseTimeValueModel.h	Thu Jun 12 14:33:45 2008 +0000
@@ -122,9 +122,6 @@
 
     virtual QVariant getData(int row, int column, int role) const
     {
-        if (role != Qt::EditRole && 
-            role != Qt::DisplayRole &&
-            role != SortRole) return QVariant();
         PointListIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return QVariant();
 
@@ -143,22 +140,18 @@
         }
     }
 
-    virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role) const
+    virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role)
     {
         if (role != Qt::EditRole) return false;
         PointListIterator i = getPointListIteratorForRow(row);
-        if (i == m_points.end()) {
-            std::cerr << "Failed to find point iterator for row " << row << std::endl;
-            return false;
-        }
+        if (i == m_points.end()) return false;
         EditCommand *command = new EditCommand(this, tr("Edit Data"));
 
         Point point(*i);
         command->deletePoint(point);
 
         switch (column) {
-        case 0: break; 
-        case 1: break;
+        case 0: case 1: point.frame = value.toInt(); break; 
         case 2: point.value = value.toDouble(); break;
         case 3: point.label = value.toString(); break;
         }