# QT Signals and slots

**URL:** <https://discourse.vtk.org/t/qt-signals-and-slots/5053>\
**Category:** Development\
**Created:** [January 25, 2021, 6:04pm UTC](https://discourse.vtk.org/t/qt-signals-and-slots/5053 "2021-01-25T18:04:25Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![dporter](https://discourse.vtk.org/letter_avatar_proxy/v4/letter/d/b5ac83/32.png) [@dporter](https://discourse.vtk.org/u/dporter)\
**Post date:** [January 25, 2021, 6:04pm UTC](https://discourse.vtk.org/t/qt-signals-and-slots/5053/1 "2021-01-25T18:04:25Z")

</div>

I’ve spent a couple of days trying to get a my QPushButton to fire and signal and recognizing a slot. The strange thing is I’ve gotten gotten other button to work perfectly, and I set up this button the same exact way as the ones that work. But when the connect statement is executed on this one I get …

QObject::connect: No such slot QtVTKApp::setWidgetsEnabled()

I read something in StackOverflow that referenced the “moc\_classname.cpp” file. Should that file be recreated every time I build? And if so, what do I do to fix it if it’s not recreating? Please let me know if you need clarification.

Here is the VS C++\_statement that generates the “No such slot” message…  
“connect(this-\>ui-\>setWidgetsEnabledToggle, SIGNAL(pressed()), this, SLOT(setWidgetsEnabled()));”

the button clickable property is set to true to making it a toggle.  
Thanks.

---

<div class="post-metadata">

**Author:** ![mwestphal](https://discourse.vtk.org/user_avatar/discourse.vtk.org/mwestphal/32/19_2.png) [@mwestphal](https://discourse.vtk.org/u/mwestphal)\
**Post date:** [January 25, 2021, 6:06pm UTC](https://discourse.vtk.org/t/qt-signals-and-slots/5053/2 "2021-01-25T18:06:42Z")

</div>

Not a VTK question. Please ask on a Qt forum or on StackOverflow.
