From: Richard Heck Date: Wed, 24 Mar 2010 15:01:50 +0000 (+0000) Subject: Use selectedIndex rather than currentIndex. The latter can be invalid if X-Git-Tag: 2.0.0~3712 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=0b5ec3d92ef1bf30684dd4a06438f546c7b8081a;p=features.git Use selectedIndex rather than currentIndex. The latter can be invalid if the focus has never gotten here. git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@33856 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/frontends/qt4/GuiSelectionManager.cpp b/src/frontends/qt4/GuiSelectionManager.cpp index b39f2a79d8..0981adc1ab 100644 --- a/src/frontends/qt4/GuiSelectionManager.cpp +++ b/src/frontends/qt4/GuiSelectionManager.cpp @@ -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)