[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: [PyQt] QSpinBox valueChanged signal
From:       Chris Wood <c.c.wood () gmail ! com>
Date:       2014-06-30 18:16:46
Message-ID: CAMWh0wv=GyNVk862t3W2d8-hUuvTt30EHftzxff=yLG0-UfdrA () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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@ftml.net> wrote:

> On 30/06/14 16:55, Chris Wood wrote:
>
>> On 30 June 2014 16:50, Vincent Vande Vyvre <vincent.vandevyvre@swing.be>
>> wrote:
>>
>>  Le 30/06/2014 17:22, Chris Wood a =C3=A9crit :
>>>
>>>  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 los=
t.
>>>>   However, I've found that if you type a value into a QSpinBox, then t=
he
>>>> signal is only emitted when focus is lost.  This contrasts to QLineEdi=
t
>>>> where textChanged (and textEdited) are emitted when the text is change=
d
>>>> and
>>>> the focus is still the QLineEdit.
>>>>
>>>> Is there a way to get round this when using a QSpinBox, so that a sign=
al
>>>> 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 wan=
t
>> :)
>>
>
> 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@riverbankcomputing.com
> http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[Attachment #5 (text/html)]

<div dir="ltr">Oops.. time for me to look sheepish. I \
had<div><br></div><div>&lt;qspinbox&gt;.setKeyboardTracking(False)</div><div><br></div><div>which, \
as the documentation for the method says, does delay the emit signal until focus is \
lost.</div>

<div><br></div><div>Chris  </div></div><div class="gmail_extra"><br><br><div \
class="gmail_quote">On 30 June 2014 17:13, Baz Walter <span dir="ltr">&lt;<a \
href="mailto:bazwal@ftml.net" target="_blank">bazwal@ftml.net</a>&gt;</span> \
wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex">On 30/06/14 16:55, Chris Wood wrote:<br> <blockquote \
class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> On 30 June 2014 16:50, Vincent Vande Vyvre &lt;<a \
href="mailto:vincent.vandevyvre@swing.be" \
target="_blank">vincent.vandevyvre@swing.be</a>&gt;<br> wrote:<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> Le 30/06/2014 17:22, Chris Wood a écrit :<br>
<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc \
solid;padding-left:1ex"> The documentation for the valueChanged signal says that<br>
<br>
`This signal is emitted whenever the spin box&#39;s value is changed. The new<br>
value&#39;s integer value is passed in i.`<br>
<br>
as opposed to editingFinished, which is only emitted when focus is lost.<br>
   However, I&#39;ve found that if you type a value into a QSpinBox, then the<br>
signal is only emitted when focus is lost.   This contrasts to QLineEdit<br>
where textChanged (and textEdited) are emitted when the text is changed and<br>
the focus is still the QLineEdit.<br>
<br>
Is there a way to get round this when using a QSpinBox, so that a signal<br>
is emitted when text is typed into the widget without having to lose focus?<br>
<br>
</blockquote>
The doc says right, probably a problem in your code.<br>
</blockquote>
<br>
<br>
I&#39;m not saying the docs are wrong (but perhaps they are little bit<br>
ambiguous), I just wanted to know if there&#39;s a way to achieve what I want<br>
> )<br>
</blockquote>
<br>
I agree with Vincent and the docs - there&#39;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.<br>


<br>
If that&#39;s not working for you, you will need to provide more details (i.e. some \
example code that demonstrates the problem).<span class="HOEnZb"><font \
color="#888888"><br> <br>
-- <br>
Regards<br>
Baz Walter<br>
______________________________<u></u>_________________<br>
PyQt mailing list      <a href="mailto:PyQt@riverbankcomputing.com" \
target="_blank">PyQt@riverbankcomputing.com</a><br> <a \
href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt" \
target="_blank">http://www.riverbankcomputing.<u></u>com/mailman/listinfo/pyqt</a></font></span></blockquote></div><br></div>



[Attachment #6 (text/plain)]

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic