QTimer and PyQt
Adrian Casey
news at outbacklinux.com
Thu Jul 22 06:56:37 EDT 2004
Jim wrote:
> Phil Thompson wrote:
>> On Tuesday 20 July 2004 12:41 pm, Adrian Casey wrote:
>>> 2. At timeout, check if any fields have changed (using the isChanged()
>>> method.) and if so, reset the timer.
>
>> For 2., you would have to iterate over each widget.
>
> Most input widgets emit a signal when their value changes ("textChanged",
> "currentChanged", "valueChanged", "clicked", etc). You could connect all
> of the signals from the widgets to a single slot which resets the timer.
>
> See both the Qt and PyQt docs on signals and slots.
>
> I liked the suggestion about revalidating the user when the user presses
> "ok" better though.
>
> Jim
So do I Jim. I settled on Phil's suggestion and implemented an eventFilter
for each QLineEdit object (using queryList("QLineEdit")) and the
installEventFilter method. Works like a champ!
Essentially, the eventFilter checks the events registered by each field and,
if they are keystrokes, a self.timer.changeinterval(120000) is done to
restart the timer with a 2 minute timeout.
Thanks again for your responses.
Regards.
Adrian.
More information about the Python-list
mailing list