This should give us the selected index, not the current index.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33850 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Richard Heck 2010-03-24 13:00:35 +00:00
parent adf858ebcc
commit 04da0f68fb

View File

@ -94,22 +94,22 @@ void GuiSelectionManager::update()
QModelIndex GuiSelectionManager::getSelectedIndex() const QModelIndex GuiSelectionManager::getSelectedIndex() const
{ {
bool const have_avl = QModelIndexList avail = availableLV->selectionModel()->selectedIndexes();
!availableLV->selectionModel()->selectedIndexes().isEmpty(); QModelIndexList sel = selectedLV->selectionModel()->selectedIndexes();
bool const have_sel = bool const have_avl = !avail.isEmpty();
!selectedLV->selectionModel()->selectedIndexes().isEmpty(); bool const have_sel = !sel.isEmpty();
if (selectedFocused()) { if (selectedFocused()) {
if (have_sel) if (have_sel)
return selectedLV->currentIndex(); return sel.front();
if (have_avl) if (have_avl)
return availableLV->currentIndex(); return avail.front();
} }
else { // available has focus else { // available has focus
if (have_avl) if (have_avl)
return availableLV->currentIndex(); return avail.front();
if (have_sel) if (have_sel)
return selectedLV->currentIndex(); return sel.front();
} }
return QModelIndex(); return QModelIndex();
} }