Skip to content

Commit

Permalink
Reorder up/down library cursor handler fallback
Browse files Browse the repository at this point in the history
As suggested in
mixxxdj#11100 (comment).
  • Loading branch information
robbert-vdh committed Dec 25, 2022
1 parent 8f422e9 commit f1a39b5
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/widget/wlibrarytableview.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -294,21 +294,21 @@ QModelIndex WLibraryTableView::moveCursor(CursorAction cursorAction,
}
}
} else {
// If the cursor does not yet exist (because the view has not
// yet been interacted with) then this selects the first or last
// row
const int row = cursorAction == QAbstractItemView::MoveUp
? pModel->rowCount() - 1
: 0;

// Selecting a hidden column doesn't work, so we'll need to find
// the first non-hidden column here
int column = 0;
while (isColumnHidden(column) && column < pModel->columnCount()) {
column++;
}

// If the cursor does not yet exist (because the view has not
// yet been interacted with) then this selects the first/last
// row
if (cursorAction == QAbstractItemView::MoveDown) {
return pModel->index(0, column);
} else {
return pModel->index(pModel->rowCount() - 1, column);
}
return pModel->index(row, column);
}
} break;
// Make the home and end keys move to the first and last row rather than
Expand Down

0 comments on commit f1a39b5

Please sign in to comment.