560 // ============================================================================= |
560 // ============================================================================= |
561 // |
561 // |
562 void MainWindow::updateSelection() |
562 void MainWindow::updateSelection() |
563 { |
563 { |
564 g_isSelectionLocked = true; |
564 g_isSelectionLocked = true; |
565 |
565 QItemSelection itemselect; |
566 ui->objectList->clearSelection(); |
566 int top = -1; |
|
567 int bottom = -1; |
567 |
568 |
568 for (LDObjectPtr obj : Selection()) |
569 for (LDObjectPtr obj : Selection()) |
569 { |
570 { |
570 if (obj->qObjListEntry == null) |
571 if (obj->qObjListEntry == null) |
571 continue; |
572 continue; |
572 |
573 |
573 obj->qObjListEntry->setSelected (true); |
574 int row = ui->objectList->row (obj->qObjListEntry); |
574 } |
575 |
575 |
576 if (top == -1) |
|
577 { |
|
578 top = bottom = row; |
|
579 } |
|
580 else |
|
581 { |
|
582 if (row != bottom + 1) |
|
583 { |
|
584 itemselect.select (ui->objectList->model()->index (top, 0), |
|
585 ui->objectList->model()->index (bottom, 0)); |
|
586 top = -1; |
|
587 } |
|
588 |
|
589 bottom = row; |
|
590 } |
|
591 } |
|
592 |
|
593 if (top != -1) |
|
594 { |
|
595 itemselect.select (ui->objectList->model()->index (top, 0), |
|
596 ui->objectList->model()->index (bottom, 0)); |
|
597 } |
|
598 |
|
599 ui->objectList->selectionModel()->select (itemselect, QItemSelectionModel::ClearAndSelect); |
576 g_isSelectionLocked = false; |
600 g_isSelectionLocked = false; |
577 } |
601 } |
578 |
602 |
579 // ============================================================================= |
603 // ============================================================================= |
580 // |
604 // |