[PyQt] QSpinBox and setLineEdit

Matt Smith melkor at orangepalantir.org
Fri Jan 30 14:15:51 GMT 2009


On Fri, 2009-01-30 at 14:55 +0100, Mads Ipsen wrote:
> import sys
> 
> from PyQt4 import QtCore, QtGui
>         
> def foo(text):
>     print 'valueChanged():', text
> 
> if __name__ == "__main__":
>     app = QtGui.QApplication(sys.argv)
>     spin_box = QtGui.QSpinBox()
>     line_edit = spin_box.lineEdit()
>     line_edit.connect(line_edit, QtCore.SIGNAL('textChanged(const
> QString
> &)'), foo)
>     spin_box.show()
>     sys.exit(app.exec_())

How about connecting to the spin box value changed?

 line_edit.connect(spin_box,QtCore.SIGNAL('valueChanged( int )'), foo)

I added that and it seems to do what you want.



More information about the PyQt mailing list