diff data/model/NoteModel.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 7226ebac8bd3
line wrap: on
line diff
--- a/data/model/NoteModel.h	Thu Jun 12 14:33:45 2008 +0000
+++ b/data/model/NoteModel.h	Fri Jun 13 21:09:43 2008 +0000
@@ -186,16 +186,15 @@
 
     virtual QVariant getData(int row, int column, int role) const
     {
+        if (column < 2) {
+            return SparseValueModel<Note>::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:
             if (role == Qt::EditRole || role == SortRole) return i->value;
             else return QString("%1 %2").arg(i->value).arg(getScaleUnits());
@@ -208,6 +207,11 @@
 
     virtual Command *getSetDataCommand(int row, int column, const QVariant &value, int role)
     {
+        if (column < 2) {
+            return SparseValueModel<Note>::getSetDataCommand
+                (row, column, value, role);
+        }
+
         if (role != Qt::EditRole) return false;
         PointListIterator i = getPointListIteratorForRow(row);
         if (i == m_points.end()) return false;