Tue, 03 Apr 2018 17:37:33 +0300
refactor
1326 | 1 | /* |
2 | * LDForge: LDraw parts authoring CAD | |
3 | * Copyright (C) 2013 - 2018 Teemu Piippo | |
4 | * | |
5 | * This program is free software: you can redistribute it and/or modify | |
6 | * it under the terms of the GNU General Public License as published by | |
7 | * the Free Software Foundation, either version 3 of the License, or | |
8 | * (at your option) any later version. | |
9 | * | |
10 | * This program is distributed in the hope that it will be useful, | |
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | * GNU General Public License for more details. | |
14 | * | |
15 | * You should have received a copy of the GNU General Public License | |
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | |
17 | */ | |
18 | ||
1291 | 19 | #pragma once |
20 | #include <QAbstractTableModel> | |
21 | ||
22 | class LDHeader; | |
23 | ||
24 | class HeaderHistoryModel : public QAbstractTableModel | |
25 | { | |
26 | public: | |
27 | enum Column | |
28 | { | |
29 | DateColumn, | |
30 | AuthorColumn, | |
31 | DescriptionColumn, | |
32 | }; | |
33 | ||
34 | HeaderHistoryModel(LDHeader* header, QObject* parent); | |
35 | ||
1292
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
36 | int rowCount(const QModelIndex& parent = {}) const override; |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
37 | int columnCount(const QModelIndex& parent = {}) const override; |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
38 | QVariant data(const QModelIndex& index, int role = Qt::DisplayRole) const override; |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
39 | bool setData(const QModelIndex& index, const QVariant& value, int role) override; |
1291 | 40 | void setHeader(LDHeader* header); |
1292
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
41 | QVariant headerData(int section, Qt::Orientation orientation, int role) const override; |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
42 | bool insertRows(int row, int count, const QModelIndex&) override; |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
43 | bool removeRows(int row, int count, const QModelIndex&) override; |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
44 | bool moveRows( |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
45 | const QModelIndex&, |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
46 | int sourceRow, |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
47 | int count, |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
48 | const QModelIndex&, |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
49 | int destinationRow |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
50 | ) override; |
66d2050d3bd9
Part history can now be edited
Teemu Piippo <teemu@hecknology.net>
parents:
1291
diff
changeset
|
51 | Qt::ItemFlags flags(const QModelIndex& index) const override; |
1291 | 52 | |
53 | private: | |
54 | LDHeader* header; | |
55 | }; |