Simplify ForgeWindow::slot_splitQuads with the new methods

Thu, 21 Mar 2013 02:48:09 +0200

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Thu, 21 Mar 2013 02:48:09 +0200
changeset 56
64899ff3bcb3
parent 55
b08f10e668e5
child 57
6e89589f1fe8

Simplify ForgeWindow::slot_splitQuads with the new methods

gui.cpp file | annotate | diff | comparison | revisions
--- a/gui.cpp	Thu Mar 21 02:45:53 2013 +0200
+++ b/gui.cpp	Thu Mar 21 02:48:09 2013 +0200
@@ -409,32 +409,17 @@
 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
 // =============================================================================
 void ForgeWindow::slot_splitQuads () {
-	if (qObjList->selectedItems().size() == 0)
-		return;
+	vector<LDObject*> objs = getSelectedObjects ();
 	
-	QList<QTreeWidgetItem*> const qaItems = qObjList->selectedItems();
-	
-	for (ulong i = 0; i < g_CurrentFile->objects.size(); ++i) {
-		LDObject* obj = g_CurrentFile->objects[i];
+	// Delete the objects that were being selected
+	for (ulong i = 0; i < (ulong)objs.size(); ++i) {
+		LDObject* obj = objs[i];
 		
 		// Don't even consider non-quads
 		if (obj->getType() != OBJ_Quad)
 			continue;
 		
-		bool bIsSelected = false;
-		
-		for (long j = 0; j < qaItems.size(); ++j) {
-			if (qaItems[j] == obj->qObjListEntry) {
-				bIsSelected = true;
-				break;
-			}
-		}
-		
-		if (!bIsSelected)
-			continue; // Was not selected
-		
 		static_cast<LDQuad*> (obj)->splitToTriangles ();
-		i++;// Skip past the second triangle
 	}
 	
 	refresh ();

mercurial