Fix crash in selection manager

Patch by Patrick De Visschere
This commit is contained in:
Juergen Spitzmueller 2019-11-19 13:47:32 +01:00
parent 18dd597feb
commit 5d45c10fc7

View File

@ -285,14 +285,14 @@ void GuiSelectionManager::addPB_clicked()
return; return;
QModelIndex const idxToAdd = selIdx.first(); QModelIndex const idxToAdd = selIdx.first();
QModelIndex const idx = selectedLV->currentIndex();
int const srows = selectedModel->rowCount(); int const srows = selectedModel->rowCount();
QMap<int, QVariant> qm = availableModel->itemData(idxToAdd); QMap<int, QVariant> qm = availableModel->itemData(idxToAdd);
insertRowToSelected(srows, qm); insertRowToSelected(srows, qm);
selectionChanged(); //signal selectionChanged(); //signal
QModelIndex const idx = selectedLV->currentIndex();
if (idx.isValid()) if (idx.isValid())
selectedLV->setCurrentIndex(idx); selectedLV->setCurrentIndex(idx);
@ -344,8 +344,7 @@ void GuiSelectionManager::upPB_clicked()
selectedModel->removeRow(pos); selectedModel->removeRow(pos);
insertRowToSelected(pos - 1, qms); insertRowToSelected(pos - 1, qms);
selectionChanged(); //signal idx = selIdx.first();
selectedLV->setCurrentIndex(idx.sibling(idx.row() - 1, idx.column())); selectedLV->setCurrentIndex(idx.sibling(idx.row() - 1, idx.column()));
selectedHasFocus_ = true; selectedHasFocus_ = true;
updateHook(); updateHook();
@ -372,8 +371,7 @@ void GuiSelectionManager::downPB_clicked()
selectedModel->removeRow(pos); selectedModel->removeRow(pos);
insertRowToSelected(pos + 1, qms); insertRowToSelected(pos + 1, qms);
selectionChanged(); //signal idx = selIdx.first();
selectedLV->setCurrentIndex(idx.sibling(idx.row() + 1, idx.column())); selectedLV->setCurrentIndex(idx.sibling(idx.row() + 1, idx.column()));
selectedHasFocus_ = true; selectedHasFocus_ = true;
updateHook(); updateHook();