mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
desktop: fix paging through dive list with page-up key, etc
In the dive list we have horrible code, which intercepts all events to save the selection before/after the event. This was necessary because we couldn't get Qt's selection data flow under control. This means intercepting all events that can change the selection. The page-up, page-down, home and end keys were forgotten. Add these cases. Fixes #2957. Signed-off-by: Berthold Stoeger <bstoeger@mail.tuwien.ac.at>
This commit is contained in:
parent
d8f35711ff
commit
06c35026d6
2 changed files with 16 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
- desktop: respect page-up, page-down, home and end keys for selection change [#2957]
|
||||||
- Use pO2 from prefernces for MOD display in equipment tab
|
- Use pO2 from prefernces for MOD display in equipment tab
|
||||||
- filter: more flexible filtering system based on individual constraints
|
- filter: more flexible filtering system based on individual constraints
|
||||||
- mobile: fix manually adding dives in the past [#2971]
|
- mobile: fix manually adding dives in the past [#2971]
|
||||||
|
|
|
@ -448,10 +448,21 @@ void DiveListView::mouseReleaseEvent(QMouseEvent *event)
|
||||||
|
|
||||||
void DiveListView::keyPressEvent(QKeyEvent *event)
|
void DiveListView::keyPressEvent(QKeyEvent *event)
|
||||||
{
|
{
|
||||||
// Hook into cursor-up and cursor-down events and update selection if necessary.
|
// Hook into key events that change the selection (i.e. cursor-up, cursor-down,
|
||||||
// See comment in mouseReleaseEvent()
|
// page-up, page-down, home and end) and update selection if necessary.
|
||||||
if (event->key() != Qt::Key_Down && event->key() != Qt::Key_Up)
|
// See comment in mouseReleaseEvent().
|
||||||
|
switch (event->key()) {
|
||||||
|
case Qt::Key_Up:
|
||||||
|
case Qt::Key_Down:
|
||||||
|
case Qt::Key_PageUp:
|
||||||
|
case Qt::Key_PageDown:
|
||||||
|
case Qt::Key_Home:
|
||||||
|
case Qt::Key_End:
|
||||||
|
break;
|
||||||
|
default:
|
||||||
return QTreeView::keyPressEvent(event);
|
return QTreeView::keyPressEvent(event);
|
||||||
|
}
|
||||||
|
|
||||||
QModelIndexList selectionBefore = selectionModel()->selectedRows();
|
QModelIndexList selectionBefore = selectionModel()->selectedRows();
|
||||||
QTreeView::keyPressEvent(event);
|
QTreeView::keyPressEvent(event);
|
||||||
QModelIndexList selectionAfter = selectionModel()->selectedRows();
|
QModelIndexList selectionAfter = selectionModel()->selectedRows();
|
||||||
|
|
Loading…
Add table
Reference in a new issue