Mercurial > hg > svcore
comparison data/model/TabularModel.h @ 1643:7a23dfe65d66 single-point
Update NoteModel to use EventSeries. This is incomplete and won't provide enough to update svgui for it yet; must also refactor to avoid duplication of nasty APIs when updating the rest of the models
author | Chris Cannam |
---|---|
date | Wed, 13 Mar 2019 14:50:10 +0000 |
parents | ad5f892c0c4d |
children | 343ef2a866a4 |
comparison
equal
deleted
inserted
replaced
1642:d591836e47ef | 1643:7a23dfe65d66 |
---|---|
16 #ifndef SV_TABULAR_MODEL_H | 16 #ifndef SV_TABULAR_MODEL_H |
17 #define SV_TABULAR_MODEL_H | 17 #define SV_TABULAR_MODEL_H |
18 | 18 |
19 #include <QVariant> | 19 #include <QVariant> |
20 #include <QString> | 20 #include <QString> |
21 | |
22 #include "base/RealTime.h" | |
21 | 23 |
22 class Command; | 24 class Command; |
23 | 25 |
24 /** | 26 /** |
25 * TabularModel is an abstract base class for models that support | 27 * TabularModel is an abstract base class for models that support |
53 | 55 |
54 virtual bool isEditable() const { return false; } | 56 virtual bool isEditable() const { return false; } |
55 virtual Command *getSetDataCommand(int /* row */, int /* column */, const QVariant &, int /* role */) { return 0; } | 57 virtual Command *getSetDataCommand(int /* row */, int /* column */, const QVariant &, int /* role */) { return 0; } |
56 virtual Command *getInsertRowCommand(int /* beforeRow */) { return 0; } | 58 virtual Command *getInsertRowCommand(int /* beforeRow */) { return 0; } |
57 virtual Command *getRemoveRowCommand(int /* row */) { return 0; } | 59 virtual Command *getRemoveRowCommand(int /* row */) { return 0; } |
60 | |
61 QVariant adaptFrameForRole(sv_frame_t frame, | |
62 sv_samplerate_t rate, | |
63 int role) const { | |
64 if (role == SortRole) return int(frame); | |
65 RealTime rt = RealTime::frame2RealTime(frame, rate); | |
66 if (role == Qt::EditRole) return rt.toString().c_str(); | |
67 else return rt.toText().c_str(); | |
68 } | |
69 | |
70 QVariant adaptValueForRole(float value, | |
71 QString unit, | |
72 int role) const { | |
73 if (role == SortRole || role == Qt::EditRole) return value; | |
74 else return QString("%1 %2").arg(value).arg(unit); | |
75 } | |
58 }; | 76 }; |
59 | 77 |
60 #endif | 78 #endif |