[PyQt] QSpinBox and setLineEdit
Mads Ipsen
mpi at comxnet.dk
Fri Jan 30 15:00:01 GMT 2009
Yes, this will do the trick provided that the function you connect to does
not take to long to update. In that case the spin box jams or locks and does
several increments of its value. This is exactly why I want to connect to
the lineedit since this is first updated once the function you connect to
returns. I post a small cone snippet in a separate post that illustrates
this.
Mads
--------- Original Besked --------
Fra: Matt Smith <melkor at orangepalantir.org>
Til: Mads Ipsen <mpi at comxnet.dk>
Cc: pyqt at riverbankcomputing.com
Emne: Re: [PyQt] QSpinBox and setLineEdit
Dato: 30/01/09 15:15
> 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