QSpinBox.valueChanged[str]

Rodrigo de Salvo Braz rodrigobraz at gmail.com
Tue Feb 2 15:11:20 GMT 2021


Hi,

I'm reading Martin Fitzpatrick's book on PyQt and came across this example
which includes a signal indexed by the function str:

widget = QSpinBox()
widget.valueChanged[str].connect(self.value_changed_str)

I have a few questions:

Q1. Why not have a signal named textChanged instead? That would match Qt's
reference <https://doc.qt.io/qt-5/qspinbox.html>. And I guess it would look
more usual.
Q2. Can other functions or types be used as index too, or just str?
Q2. How could I have figured how to use this from PyQt's reference or Qt's
reference by myself (if I had not seen the example in the book)? PyQt's
reference
<https://www.riverbankcomputing.com/static/Docs/PyQt5/api/qtwidgets/qspinbox.html?highlight=qspinbox>
indicates two signals, valueChanged(int) and valueChanged(str). Is there
some kind of convention that would allow me to understand how to use
valueChanged[str] from these documentation descriptions?

Thanks,
Rodrigo
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://www.riverbankcomputing.com/pipermail/pyqt/attachments/20210202/dfc4cc6b/attachment.htm>


More information about the PyQt mailing list