* @brief Forwards completer navigation/commit keys to the popup when visible; everything else * goes straight to the editor widget so QCompleter's focus check cannot hide the popup. */
| 536 | * goes straight to the editor widget so QCompleter's focus check cannot hide the popup. |
| 537 | */ |
| 538 | void DataModel::OutputCodeEditor::keyPressEvent(QKeyEvent* event) |
| 539 | { |
| 540 | auto* completer = m_widget.completer(); |
| 541 | if (completer && completer->popup() && completer->popup()->isVisible() |
| 542 | && SerialStudioCompleter::popupHandlesKey(event->key())) |
| 543 | QCoreApplication::sendEvent(completer->popup(), event); |
| 544 | else |
| 545 | QCoreApplication::sendEvent(&m_widget, event); |
| 546 | |
| 547 | renderWidget(); |
| 548 | } |
| 549 | |
| 550 | /** |
| 551 | * @brief Forwards key-release events to the backing QCodeEditor widget. |