src/mainWindow.cc

branch
experimental
changeset 906
d2b3c8ce8817
parent 891
00d76b281021
parent 893
ee0631d7f5d4
child 910
a6c180bffa12
child 911
5209474e9f38
--- a/src/mainWindow.cc	Tue Sep 09 01:17:36 2014 +0300
+++ b/src/mainWindow.cc	Wed Nov 05 02:07:38 2014 +0200
@@ -560,17 +560,41 @@
 void MainWindow::updateSelection()
 {
 	g_isSelectionLocked = true;
-
-	ui->objectList->clearSelection();
+	QItemSelection itemselect;
+	int top = -1;
+	int bottom = -1;
 
 	for (LDObjectPtr obj : Selection())
 	{
 		if (obj->qObjListEntry == null)
 			continue;
 
-		obj->qObjListEntry->setSelected (true);
+		int row = ui->objectList->row (obj->qObjListEntry);
+
+		if (top == -1)
+		{
+			top = bottom = row;
+		}
+		else
+		{
+			if (row != bottom + 1)
+			{
+				itemselect.select (ui->objectList->model()->index (top, 0),
+					ui->objectList->model()->index (bottom, 0));
+				top = -1;
+			}
+
+			bottom = row;
+		}
 	}
 
+	if (top != -1)
+	{
+		itemselect.select (ui->objectList->model()->index (top, 0),
+			ui->objectList->model()->index (bottom, 0));
+	}
+
+	ui->objectList->selectionModel()->select (itemselect, QItemSelectionModel::ClearAndSelect);
 	g_isSelectionLocked = false;
 }
 

mercurial