-
Notifications
You must be signed in to change notification settings - Fork 1
/
point2dmodel.h
50 lines (42 loc) · 1.62 KB
/
point2dmodel.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef POINT2DMODEL_H
#define POINT2DMODEL_H
#include <QtCore>
#include <QAbstractItemModel>
#include "imagelistwithpoint2d.h"
class ImageListModel;
class Point2DModel : public QAbstractItemModel
{
Q_OBJECT
public:
Point2DModel(QObject *parent = 0);
void clear();
void setCoreData(ImageListWithPoint2D *core);
ImageListWithPoint2D *core();
int pointCount() const;
QImage getImage(int row) const;
void removePoint(QModelIndex &index);
void movePointUp(QModelIndex &index);
void movePointDown(QModelIndex &index);
void appendPoint();
int rowCount(const QModelIndex &parent = QModelIndex()) const;
int columnCount(const QModelIndex &parent = QModelIndex()) const;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const;
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole);
QVariant headerData(int section, Qt::Orientation orientation, int role) const;
QModelIndex index(int row, int column, const QModelIndex &parent = QModelIndex()) const;
QModelIndex parent(const QModelIndex &child) const;
Qt::ItemFlags flags(const QModelIndex &index) const;
bool indexMeansImage(const QModelIndex &index) const;
bool indexMeansPoint(const QModelIndex &index) const;
private slots:
void onPointChanged(int indexImg, int indexPoint);
void onPointRemoved(int indexPoint);
void onPointAppended();
void onPointSwaped(int indexPoint1, int indexPoint2);
void onImageChanged(int indexImg);
void onImageAppended();
void onDataReset();
private:
ImageListWithPoint2D *coreData;
};
#endif // POINT2DMODEL_H