brhoom
(ibr_ex@yahoo.com)
1
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 .
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,
brhoom
(ibr_ex@yahoo.com)
2
It works now, my mistake. I should use QString instead of str as the documentation says.
I actually prefer new-style connections which would be t.textChanged.connect(tChg)
1 Like
jcfr
(Jean Christophe Fillion Robin (Kitware))
4
Generally speaking, I would also suggest to use more explicit name for slots. Prefer lineEditTextChanged
instead of tChg
brhoom
(ibr_ex@yahoo.com)
5
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.