src/model.h

changeset 1240
cebb7ef54f41
parent 1159
6ad8cdcd88d9
child 1244
68e126e8c629
equal deleted inserted replaced
1239:f1cf9d2d463a 1240:cebb7ef54f41
15 * You should have received a copy of the GNU General Public License 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/>. 16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
17 */ 17 */
18 18
19 #pragma once 19 #pragma once
20 #include <QAbstractListModel>
20 #include "main.h" 21 #include "main.h"
21 #include "linetypes/modelobject.h" 22 #include "linetypes/modelobject.h"
22 23
23 /* 24 /*
24 * This class represents a LDraw model, consisting of a vector of objects. It manages LDObject ownership. 25 * This class represents a LDraw model, consisting of a vector of objects. It manages LDObject ownership.
25 */ 26 */
26 class Model : public QObject 27 class Model : public QAbstractListModel
27 { 28 {
28 Q_OBJECT 29 Q_OBJECT
29 30
30 public: 31 public:
31 Model(class DocumentManager* manager); 32 Model(class DocumentManager* manager);
55 bool isEmpty() const; 56 bool isEmpty() const;
56 class DocumentManager* documentManager() const; 57 class DocumentManager* documentManager() const;
57 LDObject* insertFromString(int position, QString line); 58 LDObject* insertFromString(int position, QString line);
58 LDObject* addFromString(QString line); 59 LDObject* addFromString(QString line);
59 LDObject* replaceWithFromString(LDObject* object, QString line); 60 LDObject* replaceWithFromString(LDObject* object, QString line);
61
62 int rowCount(const QModelIndex& parent) const override;
63 QVariant data(const QModelIndex& index, int role) const override;
60 64
61 signals: 65 signals:
62 void objectAdded(LDObject* object); 66 void objectAdded(LDObject* object);
63 void aboutToRemoveObject(LDObject* object); 67 void aboutToRemoveObject(LDObject* object);
64 void objectModified(LDObject* object); 68 void objectModified(LDObject* object);

mercurial