[PyQt] QSpinBox valueChanged signal

Baz Walter bazwal at ftml.net
Mon Jun 30 17:13:52 BST 2014


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


More information about the PyQt mailing list