# Unable to capture clicked event from vtkQWidgetWidget

**URL:** <https://discourse.vtk.org/t/unable-to-capture-clicked-event-from-vtkqwidgetwidget/14700>\
**Category:** Support\
**Created:** [October 11, 2024, 2:18pm UTC](https://discourse.vtk.org/t/unable-to-capture-clicked-event-from-vtkqwidgetwidget/14700 "2024-10-11T14:18:09Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Paulo\_Carvalho](https://discourse.vtk.org/user_avatar/discourse.vtk.org/paulo_carvalho/32/370_2.png) [@Paulo\_Carvalho](https://discourse.vtk.org/u/Paulo_Carvalho)\
**Post date:** [October 14, 2024, 1:47pm UTC](https://discourse.vtk.org/t/unable-to-capture-clicked-event-from-vtkqwidgetwidget/14700/2 "2024-10-14T13:47:22Z")

</div>

Hello,

It is not advised to implement the constructor by hand for classes derived from VTK classes. Instead, use a VTK macro to correct use a VTK object factory:

```cpp
// Implementation of the New() function for this class.
vtkStandardNewMacro(CustomInteractorStyle);

```

Place this as a free standing line of code in a `.cpp` file (not inside class declaration nor definition).

If you still want to declare and define the class in a single shot, please, find how to correctly implement the `New()` function here: [Header-only vtk-derived class](https://discourse.vtk.org/t/header-only-vtk-derived-class/1254) .

best,

PC

---

_[View the full topic](https://discourse.vtk.org/t/unable-to-capture-clicked-event-from-vtkqwidgetwidget/14700)._
