16 #ifndef _IMAGE_MODEL_H_ 17 #define _IMAGE_MODEL_H_ 23 #include <QStringList> 35 ImagePoint(
long _frame, QString _image, QString _label) :
48 QString extraAttributes =
"")
const 51 QString(
"%1<point frame=\"%2\" image=\"%3\" label=\"%4\" %5/>\n")
52 .arg(indent).arg(
frame)
55 .arg(extraAttributes);
64 return list.join(delimiter);
92 ImageModel(
int sampleRate,
int resolution,
bool notifyOnAdd =
true) :
98 virtual void toXml(QTextStream &out,
100 QString extraAttributes =
"")
const 105 QString(
"%1 subtype=\"image\"")
106 .arg(extraAttributes));
124 virtual QString
getName()
const {
return tr(
"Edit Image"); }
152 case 0:
return tr(
"Time");
153 case 1:
return tr(
"Frame");
154 case 2:
return tr(
"Image");
155 case 3:
return tr(
"Label");
156 default:
return tr(
"Unknown");
160 virtual QVariant
getData(
int row,
int column,
int role)
const 168 if (i ==
m_points.end())
return QVariant();
171 case 2:
return i->image;
172 case 3:
return i->label;
173 default:
return QVariant();
181 (row, column, value, role);
184 if (role != Qt::EditRole)
return 0;
187 EditCommand *command =
new EditCommand(
this, tr(
"Edit Data"));
190 command->deletePoint(point);
193 case 2: point.
image = value.toString();
break;
194 case 3: point.
label = value.toString();
break;
197 command->addPoint(point);
198 return command->finish();
Command to change the image for a point.
ChangeImageCommand(ImageModel *model, const ImagePoint &point, QString newImage, QString newLabel)
int getDimensions() const
QString getTypeName() const
Return the type of the model.
virtual Command * getSetDataCommand(int row, int column, const QVariant &value, int role)
static RealTime frame2RealTime(long frame, unsigned int sampleRate)
Convert a sample frame at the given sample rate into a RealTime.
virtual void toXml(QTextStream &out, QString indent="", QString extraAttributes="") const
Stream this exportable object out to XML on a text stream.
virtual QString getName() 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
virtual QVariant getData(int row, int column, int role) const
virtual SortType getSortType(int column) const
virtual int getColumnCount() const
TabularModel methods.
virtual void addPoint(const PointType &point)
Add a point.
virtual QVariant getData(int row, int column, int role) const
static QString encodeEntities(QString)
virtual Command * getSetDataCommand(int row, int column, const QVariant &value, int role)
void toXml(QTextStream &stream, QString indent="", QString extraAttributes="") const
Stream this exportable object out to XML on a text stream.
ImageModel(int sampleRate, int resolution, bool notifyOnAdd=true)
QString toDelimitedDataString(QString delimiter, int sampleRate) const
bool operator()(const ImagePoint &p1, const ImagePoint &p2) const
Image point type for use in a SparseModel.
PointList::iterator PointListIterator
virtual bool isColumnTimeValue(int column) const
virtual QString getHeading(int column) const
ImagePoint(long _frame, QString _image, QString _label)
bool operator()(const ImagePoint &p1, const ImagePoint &p2) const
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 ...
virtual void deletePoint(const PointType &point)
Remove a point.
PointListIterator getPointListIteratorForRow(int row)
Model containing sparse data (points with some properties).