--------- Original Besked --------
Fra: Matt Smith <mel...@orangepalantir.org>
Til: pyqt@riverbankcomputing.com <pyqt@riverbankcomputing.com>
Emne: Re: [PyQt] QSpinBox and setLineEdit
Dato: 30/01/09 14:11

> 
> &gt; 
> &gt; Well, OK. My problem is that I would like to connect up to the
> &gt; textChanged(const QString &amp;amp;) signal emitted by the spinbox's
lineedit.
> &gt; This
> &gt; signal, however, is only emitted when the edit is modified directly,
not
> &gt; when it changes indirectly eg. by pressing the up/down arrows on the
> &gt; spinbox. Any suggestions for a solution?
> &gt; 
> &gt; Mads
> &gt; 
> 
> QLine claims that the textChanged is emitted even when the text is
> changed programmatically.  Have you tried connecting to it?.
> 
>
http://www.riverbankcomputing.co.uk/static/Docs/PyQt4/html/qlineedit.html#textChanged
> 
> Your previous example did not involve connecting to the line edit.
> 
> mbs
> 
> _______________________________________________
> PyQt mailing list    PyQt@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
> 

Thanks for asking, this is exactly my point. If you connect to the line
edit, the connection is olny triggered if you edit the line edit directly.
If you press the arrows on the spin box. Nothing happens. The examples below
illustrates this:

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_())
_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to