# Documentation of qt element connect strings

**URL:** <https://discourse.slicer.org/t/documentation-of-qt-element-connect-strings/5023>\
**Category:** Support\
**Created:** [December 10, 2018, 10:47am UTC](https://discourse.slicer.org/t/documentation-of-qt-element-connect-strings/5023 "2018-12-10T10:47:02Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [December 10, 2018, 10:47am UTC](https://discourse.slicer.org/t/documentation-of-qt-element-connect-strings/5023/1 "2018-12-10T10:47:02Z")

</div>

Hi,  
where to find the first parameter of connect for Qt GUI elements e.g. qt.QLineEdit(). I am using qt documentation to find them e.g. [this one](http://doc.qt.io/qt-5/qlineedit.html#textChanged) .

In Slicer interactor I tried:

```
 t = qt.QLineEdit("some text !!")     
 t.show()
 def tChg(self):
       print(t.text)
 t.connect("textChanged(str)", tChg)

```

but it didn’t work,

---

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [December 10, 2018, 10:56am UTC](https://discourse.slicer.org/t/documentation-of-qt-element-connect-strings/5023/2 "2018-12-10T10:56:20Z")

</div>

It works now, my mistake. I should use QString instead of str as the documentation says.

---

<div class="post-metadata">

**Author:** ![jamesobutler](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jamesobutler/32/7511_2.png) [@jamesobutler](https://discourse.slicer.org/u/jamesobutler)\
**Post date:** [December 10, 2018, 2:42pm UTC](https://discourse.slicer.org/t/documentation-of-qt-element-connect-strings/5023/3 "2018-12-10T14:42:49Z")

</div>

I actually prefer new-style connections which would be `t.textChanged.connect(tChg)`

---

<div class="post-metadata">

**Author:** ![jcfr](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/jcfr/32/17825_2.png) [@jcfr](https://discourse.slicer.org/u/jcfr)\
**Post date:** [December 10, 2018, 4:04pm UTC](https://discourse.slicer.org/t/documentation-of-qt-element-connect-strings/5023/4 "2018-12-10T16:04:04Z")

</div>

Generally speaking, I would also suggest to use more explicit name for slots. Prefer `lineEditTextChanged` instead of `tChg`

---

<div class="post-metadata">

**Author:** ![brhoom](https://sea2.discourse-cdn.com/flex002/user_avatar/discourse.slicer.org/brhoom/32/1228_2.png) [@brhoom](https://discourse.slicer.org/u/brhoom)\
**Post date:** [December 10, 2018, 5:22pm UTC](https://discourse.slicer.org/t/documentation-of-qt-element-connect-strings/5023/5 "2018-12-10T17:22:32Z")

</div>

> t.textChanged.connect(tChg)

cool! now I know where to find these events.

> I would also suggest to use more explicit name for slots

Sure, a code must be readable.
