| 117 | } |
| 118 | |
| 119 | auto ModPage::eventFilter(QObject* watched, QEvent* event) -> bool |
| 120 | { |
| 121 | if (watched == ui->searchEdit && event->type() == QEvent::KeyPress) { |
| 122 | auto* keyEvent = dynamic_cast<QKeyEvent*>(event); |
| 123 | if (keyEvent->key() == Qt::Key_Return) { |
| 124 | triggerSearch(); |
| 125 | keyEvent->accept(); |
| 126 | return true; |
| 127 | } else { |
| 128 | if (m_search_timer.isActive()) |
| 129 | m_search_timer.stop(); |
| 130 | |
| 131 | m_search_timer.start(350); |
| 132 | } |
| 133 | } else if (watched == ui->packView && event->type() == QEvent::KeyPress) { |
| 134 | auto* keyEvent = dynamic_cast<QKeyEvent*>(event); |
| 135 | if (keyEvent->key() == Qt::Key_Return) { |
| 136 | onModSelected(); |
| 137 | |
| 138 | // To have the 'select mod' button outlined instead of the 'review and confirm' one |
| 139 | ui->modSelectionButton->setFocus(Qt::FocusReason::ShortcutFocusReason); |
| 140 | ui->packView->setFocus(Qt::FocusReason::NoFocusReason); |
| 141 | |
| 142 | keyEvent->accept(); |
| 143 | return true; |
| 144 | } |
| 145 | } |
| 146 | return QWidget::eventFilter(watched, event); |
| 147 | } |
| 148 | |
| 149 | |
| 150 | /******** Callbacks to events in the UI (set up in the derived classes) ********/ |