mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 10:00:33 +00:00
Put new citation after selected item rather than at end of list.
Fixes bug #12940.
Patch from Daniel.
(cherry picked from commit 40ae8644f9
)
This commit is contained in:
parent
37a865762b
commit
1d7c8325f2
@ -285,10 +285,13 @@ void GuiSelectionManager::addPB_clicked()
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
QModelIndex const idxToAdd = selIdx.first();
|
QModelIndex const idxToAdd = selIdx.first();
|
||||||
int const srows = selectedModel->rowCount();
|
// Add item after selected item
|
||||||
|
int const currentRow = selectedLV->currentIndex().row();
|
||||||
|
int const srows = currentRow == -1 ? selectedModel->rowCount() :
|
||||||
|
currentRow + 1;
|
||||||
|
|
||||||
QMap<int, QVariant> qm = availableModel->itemData(idxToAdd);
|
QMap<int, QVariant> qm = availableModel->itemData(idxToAdd);
|
||||||
insertRowToSelected(srows, qm);
|
bool const isAdded = insertRowToSelected(srows, qm);
|
||||||
|
|
||||||
selectionChanged(); //signal
|
selectionChanged(); //signal
|
||||||
|
|
||||||
@ -296,6 +299,12 @@ void GuiSelectionManager::addPB_clicked()
|
|||||||
if (idx.isValid())
|
if (idx.isValid())
|
||||||
selectedLV->setCurrentIndex(idx);
|
selectedLV->setCurrentIndex(idx);
|
||||||
|
|
||||||
|
// select and show last added item
|
||||||
|
if (isAdded) {
|
||||||
|
QModelIndex idx = selectedModel->index(srows, 0);
|
||||||
|
selectedLV->setCurrentIndex(idx);
|
||||||
|
}
|
||||||
|
|
||||||
updateHook();
|
updateHook();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,6 +88,8 @@ What's new
|
|||||||
|
|
||||||
- Allow "longest label" to be empty (bug 11934).
|
- Allow "longest label" to be empty (bug 11934).
|
||||||
|
|
||||||
|
- Put new citation after selected item rather than at end of list (bug 12940).
|
||||||
|
|
||||||
|
|
||||||
* INTERNALS
|
* INTERNALS
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user