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