Sun, 10 Jun 2018 23:07:24 +0300
fixed bugs regarding circular primitives
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 | ||
1308
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
19 | #pragma once |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
20 | #include <QAbstractTableModel> |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
21 | #include "main.h" |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
22 | |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
23 | class LibrariesModel : public QAbstractTableModel |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
24 | { |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
25 | public: |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
26 | enum Column { RoleColumn, PathColumn }; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
27 | |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
28 | LibrariesModel(Libraries& libraries, QObject* parent); |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
29 | |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
30 | QVariant data(const QModelIndex& index, int role) const override; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
31 | int rowCount(const QModelIndex& parent = {}) const override; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
32 | int columnCount(const QModelIndex& parent = {}) const override; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
33 | bool setData(const QModelIndex& index, const QVariant& value, int role) override; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
34 | Qt::ItemFlags flags(const QModelIndex& index) const override; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
35 | bool moveRows( |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
36 | const QModelIndex&, |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
37 | int sourceRow, |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
38 | int count, |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
39 | const QModelIndex&, |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
40 | int destinationRow |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
41 | ) override; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
42 | bool removeRows(int row, int count, const QModelIndex&) override; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
43 | bool insertRows(int startRow, int count, const QModelIndex&) override; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
44 | |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
45 | private: |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
46 | Libraries& libraries; |
dcc8c02530c2
Begin rework to add support for multiple libraries
Teemu Piippo <teemu@hecknology.net>
parents:
diff
changeset
|
47 | }; |