# Key press events not working with QVTKInteractor

**URL:** https://discourse.vtk.org/t/key-press-events-not-working-with-qvtkinteractor/14026
**Category:** Support
**Created:** [June 12, 2024, 4:00pm UTC](https://discourse.vtk.org/t/key-press-events-not-working-with-qvtkinteractor/14026 "2024-06-12T16:00:33Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![auffii](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/a/cdc98d/32.png) [@auffii](https://discourse.vtk.org/u/auffii)
#### Post date: [June 12, 2024, 4:00pm UTC](https://discourse.vtk.org/t/key-press-events-not-working-with-qvtkinteractor/14026/1 "2024-06-12T16:00:33Z")

</div>

Hi, although mouse press events function as expected with QVTKInteractor, key press events are not being caught. Are there any working examples for QVTKInteractor?

```auto
QQuickVTKItem::vtkUserData MyVTKItem::initializeVTK(vtkRenderWindow* renderWindow) {
    ...
    vtkNew<QVTKInteractor> renderWindowInteractor;
    renderWindowInteractor->SetRenderWindow(renderWindow);
    renderWindowInteractor->Initialize();

    vtkNew<KeyPressInteractorStyle> style;
    style->SetDefaultRenderer(renderer);

    renderWindowInteractor->SetInteractorStyle(style);
    renderWindowInteractor->Start();

```

The above is a partial code listing where I have used vtk-examples/Cxx/Interaction/KeypressEvents.

Thanks!
