35 public: |
35 public: |
36 class EditContext; |
36 class EditContext; |
37 Model(QObject* parent = nullptr); |
37 Model(QObject* parent = nullptr); |
38 Model(const Model&) = delete; |
38 Model(const Model&) = delete; |
39 int size() const; |
39 int size() const; |
|
40 ldraw::id_t at(int index) const; |
40 EditContext edit(); |
41 EditContext edit(); |
41 int rowCount(const QModelIndex&) const override; |
42 int rowCount(const QModelIndex&) const override; |
42 QVariant data(const QModelIndex& index, int role) const override; |
43 QVariant data(const QModelIndex& index, int role) const override; |
43 QVariant getHeaderProperty(const HeaderProperty property); |
44 QVariant getHeaderProperty(const HeaderProperty property); |
44 const QString& getName() const; |
45 const QString& getName() const; |
86 } |
87 } |
87 void getObjectPolygons( |
88 void getObjectPolygons( |
88 const int index, |
89 const int index, |
89 std::vector<gl::Polygon>& polygons_out, |
90 std::vector<gl::Polygon>& polygons_out, |
90 ldraw::GetPolygonsContext* context) const; |
91 ldraw::GetPolygonsContext* context) const; |
|
92 void editFinished(); |
|
93 void objectModified(ldraw::id_t id); |
91 bool modified = false; |
94 bool modified = false; |
92 QString path; |
95 QString path; |
93 LDHeader header; |
96 LDHeader header; |
94 std::vector<ModelObjectPointer> body; |
97 std::vector<ModelObjectPointer> body; |
95 std::map<ldraw::id_t, ldraw::Object*> objectsById; |
98 std::map<ldraw::id_t, ldraw::Object*> objectsById; |
96 mutable std::vector<gl::Polygon> cachedPolygons; |
99 mutable std::vector<gl::Polygon> cachedPolygons; |
97 mutable bool needRecache = true; |
100 mutable bool needRecache = true; |
|
101 int editCounter = 0; |
98 }; |
102 }; |
99 |
103 |
100 /** |
104 /** |
101 * \brief Call @c f for all objects of type \c R |
105 * \brief Call @c f for all objects of type \c R |
102 */ |
106 */ |