| 542 | } |
| 543 | |
| 544 | void InputEditorView::keyPressEvent(QKeyEvent *event) |
| 545 | { |
| 546 | /* Check for the Home and End keys */ |
| 547 | if ((event->key() == Qt::Key_End) && (event->modifiers() == Qt::NoModifier)) { |
| 548 | /* Select the last frame */ |
| 549 | QModelIndex newSel = inputEditorModel->index(inputEditorModel->rowCount()-1, 0); |
| 550 | selectionModel()->clear(); |
| 551 | setCurrentIndex(newSel); |
| 552 | selectionModel()->select(newSel, QItemSelectionModel::Select | QItemSelectionModel::Rows); |
| 553 | event->accept(); |
| 554 | } |
| 555 | else if ((event->key() == Qt::Key_Home) && (event->modifiers() == Qt::NoModifier)) { |
| 556 | /* Select the first frame */ |
| 557 | QModelIndex newSel = inputEditorModel->index(0, 0); |
| 558 | selectionModel()->clear(); |
| 559 | setCurrentIndex(newSel); |
| 560 | selectionModel()->select(newSel, QItemSelectionModel::Select | QItemSelectionModel::Rows); |
| 561 | event->accept(); |
| 562 | } |
| 563 | |
| 564 | /* Ignore auto-repeat events for hotkeys */ |
| 565 | if (event->isAutoRepeat()) |
| 566 | return QTableView::keyPressEvent(event); |
| 567 | |
| 568 | /* We accept hotkeys when this window has focus */ |
| 569 | keysym_t mod = convertQtModifiers(event->modifiers()); |
| 570 | keysym_t ks = context->config.km->nativeToKeysym(event->nativeVirtualKey()); |
| 571 | |
| 572 | /* Special case for <tab> key where event->nativeVirtualKey() returns 0 */ |
| 573 | if (event->key() == Qt::Key_Tab) |
| 574 | ks = 0xff09; /* XK_Tab */ |
| 575 | |
| 576 | if (context->config.km->hotkey_mapping.find(ks | mod) != context->config.km->hotkey_mapping.end()) { |
| 577 | HotKey hk = context->config.km->hotkey_mapping[ks | mod]; |
| 578 | context->hotkey_pressed_queue.push(hk.type); |
| 579 | return; |
| 580 | } |
| 581 | if (context->config.km->hotkey_mapping.find(ks) != context->config.km->hotkey_mapping.end()) { |
| 582 | HotKey hk = context->config.km->hotkey_mapping[ks]; |
| 583 | context->hotkey_pressed_queue.push(hk.type); |
| 584 | return; |
| 585 | } |
| 586 | |
| 587 | return QTableView::keyPressEvent(event); |
| 588 | } |
| 589 | |
| 590 | void InputEditorView::keyReleaseEvent(QKeyEvent *event) |
| 591 | { |
nothing calls this directly
no test coverage detected