[PyQt] QSpinBox valueChanged signal

Chris Wood c.c.wood at gmail.com
Mon Jun 30 19:16:46 BST 2014


Oops.. time for me to look sheepish. I had

<qspinbox>.setKeyboardTracking(False)

which, as the documentation for the method says, does delay the emit signal
until focus is lost.

Chris


On 30 June 2014 17:13, Baz Walter <bazwal at ftml.net> wrote:

> On 30/06/14 16:55, Chris Wood wrote:
>
>> On 30 June 2014 16:50, Vincent Vande Vyvre <vincent.vandevyvre at swing.be>
>> wrote:
>>
>>  Le 30/06/2014 17:22, Chris Wood a écrit :
>>>
>>>  The documentation for the valueChanged signal says that
>>>>
>>>> `This signal is emitted whenever the spin box's value is changed. The
>>>> new
>>>> value's integer value is passed in i.`
>>>>
>>>> as opposed to editingFinished, which is only emitted when focus is lost.
>>>>   However, I've found that if you type a value into a QSpinBox, then the
>>>> signal is only emitted when focus is lost.  This contrasts to QLineEdit
>>>> where textChanged (and textEdited) are emitted when the text is changed
>>>> and
>>>> the focus is still the QLineEdit.
>>>>
>>>> Is there a way to get round this when using a QSpinBox, so that a signal
>>>> is emitted when text is typed into the widget without having to lose
>>>> focus?
>>>>
>>>>  The doc says right, probably a problem in your code.
>>>
>>
>>
>> I'm not saying the docs are wrong (but perhaps they are little bit
>> ambiguous), I just wanted to know if there's a way to achieve what I want
>> :)
>>
>
> I agree with Vincent and the docs - there's no ambiguity: valueChanged
> *is* emitted whenever new text is entered (so long as the changes result in
> a valid value). So the way to achieve what you want is to simply connect to
> that signal.
>
> If that's not working for you, you will need to provide more details (i.e.
> some example code that demonstrates the problem).
>
> --
> Regards
> Baz Walter
> _______________________________________________
> PyQt mailing list    PyQt at riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20140630/61cbfdca/attachment.html>


More information about the PyQt mailing list