16 #ifndef _TEXT_MODEL_H_ 17 #define _TEXT_MODEL_H_ 23 #include <QStringList> 35 TextPoint(
long _frame,
float _height, QString _label) :
46 void toXml(QTextStream &stream, QString indent =
"",
47 QString extraAttributes =
"")
const 49 stream << QString(
"%1<point frame=\"%2\" height=\"%3\" label=\"%4\" %5/>\n")
58 list << QString(
"%1").arg(
height);
60 return list.join(delimiter);
88 TextModel(
int sampleRate,
int resolution,
bool notifyOnAdd =
true) :
92 virtual void toXml(QTextStream &out,
94 QString extraAttributes =
"")
const 99 QString(
"%1 subtype=\"text\"")
100 .arg(extraAttributes));
117 case 0:
return tr(
"Time");
118 case 1:
return tr(
"Frame");
119 case 2:
return tr(
"Height");
120 case 3:
return tr(
"Label");
121 default:
return tr(
"Unknown");
125 virtual QVariant
getData(
int row,
int column,
int role)
const 133 if (i ==
m_points.end())
return QVariant();
136 case 2:
return i->height;
137 case 3:
return i->label;
138 default:
return QVariant();
146 (row, column, value, role);
149 if (role != Qt::EditRole)
return 0;
152 EditCommand *command =
new EditCommand(
this, tr(
"Edit Data"));
155 command->deletePoint(point);
158 case 2: point.
height = value.toDouble();
break;
159 case 3: point.
label = value.toString();
break;
162 command->addPoint(point);
163 return command->finish();
virtual void toXml(QTextStream &out, QString indent="", QString extraAttributes="") const
Stream this exportable object out to XML on a text stream.
QString getTypeName() const
Return the type of the model.
TextModel(int sampleRate, int resolution, bool notifyOnAdd=true)
virtual QString getHeading(int column) const
static RealTime frame2RealTime(long frame, unsigned int sampleRate)
Convert a sample frame at the given sample rate into a RealTime.
virtual int getColumnCount() const
TabularModel methods.
virtual SortType getSortType(int column) const
virtual void toXml(QTextStream &out, QString indent="", QString extraAttributes="") const
Stream this exportable object out to XML on a text stream.
PointList::const_iterator PointListConstIterator
void toXml(QTextStream &stream, QString indent="", QString extraAttributes="") const
Stream this exportable object out to XML on a text stream.
QString toDelimitedDataString(QString delimiter, int sampleRate) const
virtual QVariant getData(int row, int column, int role) const
int getDimensions() const
virtual bool isColumnTimeValue(int column) const
static QString encodeEntities(QString)
virtual Command * getSetDataCommand(int row, int column, const QVariant &value, int role)
TextPoint(long _frame, float _height, QString _label)
Text point type for use in a SparseModel.
bool operator()(const TextPoint &p1, const TextPoint &p2) const
PointList::iterator PointListIterator
bool operator()(const TextPoint &p1, const TextPoint &p2) const
virtual Command * getSetDataCommand(int row, int column, const QVariant &value, int role)
std::string toString(bool align=false) const
Return a human-readable debug-type string to full precision (probably not a format to show to a user ...
PointListIterator getPointListIteratorForRow(int row)
Model containing sparse data (points with some properties).
virtual QVariant getData(int row, int column, int role) const