Use the sceneView->selectAll() instead of doing the selection by hand.

This commit is contained in:
Maxime Gimeno 2020-06-24 13:53:54 +02:00
parent 9aca6296d4
commit 645db67cea
1 changed files with 3 additions and 4 deletions

View File

@ -1337,6 +1337,8 @@ void MainWindow::selectSceneItem(int i)
else {
QItemSelection s =
proxyModel->mapSelectionFromSource(scene->createSelection(i));
if(s.empty())
return;
QModelIndex mi = proxyModel->mapFromSource(scene->getModelIndexFromId(i).first());
sceneView->setCurrentIndex(mi);
sceneView->selectionModel()->select(s,
@ -1407,10 +1409,7 @@ void MainWindow::removeSceneItemFromSelection(int i)
void MainWindow::selectAll()
{
QItemSelection s =
proxyModel->mapSelectionFromSource(scene->createSelectionAll());
sceneView->selectionModel()->select(s,
QItemSelectionModel::ClearAndSelect);
sceneView->selectAll();
}
int MainWindow::getSelectedSceneItemIndex() const