src/mainwindow.cpp

changeset 1031
55c0d3beea0d
parent 1025
4949da3fb4b3
child 1033
32153a1dbb15
--- a/src/mainwindow.cpp	Wed Feb 17 03:24:07 2016 +0200
+++ b/src/mainwindow.cpp	Wed Feb 17 19:54:21 2016 +0200
@@ -519,7 +519,7 @@
 	if (m_isSelectionLocked == true or m_currentDocument == nullptr)
 		return;
 
-	LDObjectList priorSelection = selectedObjects();
+	QSet<LDObject*> priorSelection = selectedObjects().toSet();
 
 	// Get the objects from the object list selection
 	m_currentDocument->clearSelection();
@@ -542,10 +542,7 @@
 	updateSelection();
 
 	// Update the GL renderer
-	LDObjectList compound = priorSelection + selectedObjects();
-	removeDuplicates (compound);
-
-	for (LDObject* obj : compound)
+	for (LDObject* obj : (priorSelection + selectedObjects().toSet()))
 		renderer()->compileObject (obj);
 
 	renderer()->update();
@@ -720,7 +717,7 @@
 
 // ---------------------------------------------------------------------------------------------------------------------
 //
-void MainWindow::spawnContextMenu (const QPoint pos)
+void MainWindow::spawnContextMenu (const QPoint& position)
 {
 	const bool single = (selectedObjects().size() == 1);
 	LDObject* singleObj = single ? selectedObjects().first() : nullptr;
@@ -781,7 +778,7 @@
 		contextMenu->addAction (ui.actionSetDrawDepth);
 	}
 
-	contextMenu->exec (pos);
+	contextMenu->exec(position);
 }
 
 // ---------------------------------------------------------------------------------------------------------------------
@@ -890,15 +887,6 @@
 	m_renderer->messageLog()->addLine (msg);
 }
 
-// ============================================================================
-void ObjectList::contextMenuEvent (QContextMenuEvent* ev)
-{
-	MainWindow* mainWindow = qobject_cast<MainWindow*>(parent());
-
-	if (mainWindow)
-		mainWindow->spawnContextMenu (ev->globalPos());
-}
-
 // ---------------------------------------------------------------------------------------------------------------------
 //
 QPixmap GetIcon (QString iconName)

mercurial