# Add and connect properly GUI components to Slicer module

**URL:** <https://discourse.slicer.org/t/add-and-connect-properly-gui-components-to-slicer-module/9665>\
**Category:** Development\
**Tags:** loadable-module\
**Created:** [December 30, 2019, 6:43pm UTC](https://discourse.slicer.org/t/add-and-connect-properly-gui-components-to-slicer-module/9665 "2019-12-30T18:43:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![CreepyTrick](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@CreepyTrick](https://discourse.slicer.org/u/CreepyTrick)\
**Post date:** [December 30, 2019, 6:43pm UTC](https://discourse.slicer.org/t/add-and-connect-properly-gui-components-to-slicer-module/9665/1 "2019-12-30T18:43:31Z")

</div>

Hello

I come here again for a basic question … how to add and connects UI components like button and all in a new **Loadable** (so c++) module ?

I found how to add: The UI file that i can open with Qt and add any component i want, but i dont know how to connect them properly …. nether where to do it.

I got the base `qSlicerModuleNameFooBarWidget` and other file with “Widget” in their name …  
But if i want to connect the basic “foo bar” button (created by default), how and where i should do this ?

(I’m working with Visual Studio)

---

<div class="post-metadata">

**Author:** ![lassoan](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/lassoan/32/13_2.png) [@lassoan](https://discourse.slicer.org/u/lassoan)\
**Post date:** [December 30, 2019, 7:56pm UTC](https://discourse.slicer.org/t/add-and-connect-properly-gui-components-to-slicer-module/9665/2 "2019-12-30T19:56:31Z")

</div>

Usually you create all connections in the widget’s `setup` method. You can use all of Slicer’s loadable modules as examples. For example, see [source code of Tables module widget](https://github.com/Slicer/Slicer/blob/master/Modules/Loadable/Tables/qSlicerTablesModuleWidget.cxx#L109-L164).

---

<div class="post-metadata">

**Author:** ![CreepyTrick](https://avatars.discourse-cdn.com/v4/letter/c/f9ae1b/32.png) [@CreepyTrick](https://discourse.slicer.org/u/CreepyTrick)\
**Post date:** [December 31, 2019, 1:20pm UTC](https://discourse.slicer.org/t/add-and-connect-properly-gui-components-to-slicer-module/9665/3 "2019-12-31T13:20:20Z")

</div>

Alright, thanks for your answer 🙂 .
