]> git.lyx.org Git - features.git/commitdiff
This should give us the selected index, not the current index.
authorRichard Heck <rgheck@comcast.net>
Wed, 24 Mar 2010 13:00:35 +0000 (13:00 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 24 Mar 2010 13:00:35 +0000 (13:00 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33850 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiSelectionManager.cpp

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