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
This commit is contained in:
Richard Heck 2010-03-24 15:01:50 +00:00
parent 2455df7cdc
commit 0b5ec3d92e

View 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)