* @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. */
| 663 | * goes straight to the editor widget so QCompleter's focus check cannot hide the popup. |
| 664 | */ |
| 665 | void DataModel::JsCodeEditor::keyPressEvent(QKeyEvent* event) |
| 666 | { |
| 667 | auto* completer = m_widget.completer(); |
| 668 | if (completer && completer->popup() && completer->popup()->isVisible() |
| 669 | && SerialStudioCompleter::popupHandlesKey(event->key())) |
| 670 | QCoreApplication::sendEvent(completer->popup(), event); |
| 671 | else |
| 672 | QCoreApplication::sendEvent(&m_widget, event); |
| 673 | |
| 674 | renderWidget(); |
| 675 | } |
| 676 | |
| 677 | /** |
| 678 | * @brief Forwards key-release events to the backing QCodeEditor widget. |