]> git.lyx.org Git - features.git/commitdiff
Use selectedIndex rather than currentIndex. The latter can be invalid if
authorRichard Heck <rgheck@comcast.net>
Wed, 24 Mar 2010 15:01:50 +0000 (15:01 +0000)
committerRichard Heck <rgheck@comcast.net>
Wed, 24 Mar 2010 15:01:50 +0000 (15:01 +0000)
the focus has never gotten here.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33856 a592a061-630c-0410-9148-cb99ea01b6c8

src/frontends/qt4/GuiSelectionManager.cpp

index b39f2a79d8fdd30e58a44c622080b61ce5becb41..0981adc1ab75254c04c7bb2a3e81b7a5a903c486 100644 (file)
@@ -281,7 +281,11 @@ void GuiSelectionManager::deletePB_clicked()
 
 void GuiSelectionManager::upPB_clicked()
 {
-       QModelIndex idx = selectedLV->currentIndex();
+       QModelIndexList selIdx =
+               selectedLV->selectionModel()->selectedIndexes();
+       if (selIdx.isEmpty())
+               return;
+       QModelIndex idx = selIdx.first();
 
        int const pos = idx.row();
        if (pos <= 0)
@@ -302,7 +306,11 @@ void GuiSelectionManager::upPB_clicked()
 
 void GuiSelectionManager::downPB_clicked()
 {
-       QModelIndex idx = selectedLV->currentIndex();
+       QModelIndexList selIdx =
+               selectedLV->selectionModel()->selectedIndexes();
+       if (selIdx.isEmpty())
+               return;
+       QModelIndex idx = selIdx.first();
 
        int const pos = idx.row();
        if (pos >= selectedModel->rowCount() - 1)