-
Notifications
You must be signed in to change notification settings - Fork 0
/
boardwindowlistmodel.h
79 lines (54 loc) · 1.84 KB
/
boardwindowlistmodel.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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
#ifndef BOARDMODEL_H
#define BOARDMODEL_H
#include "board.h"
#include "boardmodelproxy.h"
#include "strikelistmodel.h"
#include <QAbstractListModel>
class BoardWindowListModel : public QAbstractListModel
{
Q_OBJECT
public:
explicit BoardWindowListModel(QObject *parent = nullptr);
~BoardWindowListModel();
//不要留空行: 有时候莫名其妙出错
enum {
BidRole,
TitleRole,
HiddenRole,
BackColorRole,
HiddenArchivedRole,
CreatedRole,
UpdatedRole,
WindowXRole,
WindowYRole,
WindowWidthRole,
WindowHeightRole,
FontSizeRole,
FontFamilyRole,
StrikeListModelRole, //特殊, 是ListModel类型的, 不是普通QList
};
int rowCount(const QModelIndex &parent = QModelIndex()) const override;
QVariant data(const QModelIndex &index, int role = Qt::DisplayRole) const override;
bool setData(const QModelIndex &index, const QVariant &value,
int role = Qt::EditRole) override;
Qt::ItemFlags flags(const QModelIndex& index) const override;
QHash<int, QByteArray> roleNames() const override;
bool insertRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
bool removeRows(int row, int count, const QModelIndex &parent = QModelIndex()) override;
//新增一个白板
Q_INVOKABLE bool addBoard();
Q_INVOKABLE bool removeBoard(int index);
Q_INVOKABLE void viewArchivedStrikes(int index);
QList<BoardModelProxy *> *boardModelProxys() const;
//void setBoardModelProxys(QList<BoardModelProxy *> *boardModelProxys);
QList<Board *> *boards() const;
//void setBoards(QList<Board *> *boards);
void setBoardsAndProxy(QList<Board *> *boards);
signals:
void userWillViewArchivedStrikes(QString bid);
private:
QList<Board*> *m_boards;
//Board Proxy Model
QList<BoardModelProxy*> *m_boardModelProxys;
};
#endif // BOARDMODEL_H