src/modeleditcontext.cpp

changeset 116
aad3e897bc32
parent 112
5760cbb32bc0
child 133
e39326ee48dc
--- a/src/modeleditcontext.cpp	Tue Jul 27 11:11:32 2021 +0300
+++ b/src/modeleditcontext.cpp	Tue Jul 27 12:44:54 2021 +0300
@@ -113,13 +113,12 @@
 ) -> std::optional<std::pair<ldraw::triangleid_t, ldraw::triangleid_t>>
 {
 	std::optional<std::pair<ldraw::triangleid_t, ldraw::triangleid_t>> result;
-	QModelIndex index;
-	const ldraw::Quadrilateral* quadrilateral = editor.model().get(quadrilateral_id, &index);
-	if (quadrilateral != nullptr)
+	const auto resolved = editor.model().get2(quadrilateral_id);
+	if (resolved.object != nullptr)
 	{
-		const ldraw::Color color = quadrilateral->colorIndex;
-		const std::array<geom::Triangle, 2> split = splitTriangles(splitType, quadrilateral->points);
-		const int position = index.row();
+		const ldraw::Color color = resolved.object->colorIndex;
+		const std::array<geom::Triangle, 2> split = splitTriangles(splitType, resolved.object->points);
+		const int position = resolved.index.row();
 		editor.remove(position);
 		result = std::make_pair(
 			editor.insert<ldraw::Triangle>(position, split[0].points, color),

mercurial