[PyKDE] Next attempt to tackle QSpinBox strangeness

Hans-Peter Jansen hpj at urpla.net
Thu Jan 23 19:47:00 GMT 2003


Hi *,

attached, you will find an app to reproduce some strangeness with QSpinBox 
behaviour.

Problem: reimplemented QSpinBox don't get focus events and doesn't behave
correctly on up/down cursor key events (value doesn't change).

This happens at least with SuSE-Versions 8.0 and 8.1, with all PyQt-Versions
up to the snapshot from 2003/01/11.

If you have a couple of spare minutes, please run the attached script from
a shell, <tab><cursor up><cursor down><tab><space> and watch console output.
I get: (# comments added)
# startup
SpinBox event: ChildInserted
SpinBox event: ChildInserted
PushButton event: Move
PushButton event: Resize
PushButton event: Show
SpinBox event: Move
SpinBox event: Resize
SpinBox event: Show
SpinBox event: LayoutHint
PushButton event: Paint
PushButton event: WindowActivate
SpinBox event: WindowActivate
PushButton event: FocusIn
PushButton focusInEvent
PushButton event: Paint
# startup done
# <tab>
PushButton event: AccelOverride
PushButton event: KeyPress
PushButton event: FocusOut
PushButton focusOutEvent
PushButton event: Paint
SpinBox event: KeyRelease
# PushButton class gets focus event correctly, SpinBox don't
# <cursor up>
SpinBox event: AccelOverride
SpinBox event: KeyPress
SpinBox event: KeyRelease
# SpinBox doesn't change the value, consequently no valueChanged signal
# <cursor down>
SpinBox event: AccelOverride
SpinBox event: KeyPress
SpinBox event: KeyRelease
# again..
# <tab>
SpinBox event: AccelOverride
PushButton event: FocusIn
PushButton focusInEvent
PushButton event: Paint
PushButton event: KeyRelease
# again, PushButton class gets focus event correctly
# <space>
PushButton event: AccelOverride
PushButton event: KeyPress
PushButton event: Paint
PushButton event: KeyRelease
PushButton event: Paint
close app
PushButton event: WindowDeactivate
SpinBox event: WindowDeactivate
PushButton event: FocusOut
PushButton focusOutEvent
PushButton event: Hide
SpinBox event: Hide
# finished

If your output differs significantly from this log, please give me 
a note, mentioning your OS, Qt, and PyQt versions. This is a long 
standing problem, I'm suffering from and would like to get solved 
somehow. Therefore, I'm going to translate this app to c++ in order 
to check this behaviour of Qt directly soon.

Interesting side note: I needed to prepare the event() handlers not to
call the base class in order to avoid an attribute error during qApp.quit().
Phil, it appears, that the QSpinBox base class disappears while subclassed 
SpinBox event() handler is active. This doesn't look right to me.

TIA,
Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sbtest.py
Type: text/x-python
Size: 4497 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20030123/86f4c32e/sbtest.py


More information about the PyQt mailing list