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

List:       pykde
Subject:    Re: [PyKDE] Next attempt to tackle QSpinBox strangeness
From:       Phil Thompson <phil () river-bank ! demon ! co ! uk>
Date:       2003-01-25 16:02:44
[Download RAW message or body]

On Friday 24 January 2003 1:43 pm, Hans-Peter Jansen wrote:
> On Thursday 23 January 2003 19:46, me wrote:
> > Problem: reimplemented QSpinBox don't get focus events and doesn't behave
> > correctly on up/down cursor key events (value doesn't change).
>
> Also, manually editing the QSpinBox value doesn't generate a valueChanged
> signal, nor does it revert invalid values.
>
> > Therefore, I'm going to translate this app to c++ in order
> > to check this behaviour of Qt directly soon.
>
> Done, attached. Looks like the c++ version doesn't generate focus events,
> either, but behaves correctly on cursor keys and manual editing.
> Consequently both actions generate a valueChanged signal, unlike the py
> version.

Thanks for putting the effort into this - it was very helpful. The bug is that 
qspinbox.sip should say...

bool eventFilter(QObject *,QEvent *);

...instead of...

void eventFilter(QObject *,QEvent *);

It will be fixed in tonight's snapshot.

> > 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.
>
> While making both versions functional identical, I've rewritten the event
> decoder qEvent(), but couldn't believe my eyes: during qApp.quit() the
> value of the global defined qEventDict{} in the .py script is replaced
> with a None value somewhere under the covers! Please remove the try/except
> statement in qEvent, uncomment the print statement and look yourself:
>
> close app
> PushButton event: <type 'NoneType'>
> Traceback (most recent call last):
>   File "sbtest.py", line 121, in event
>     print "PushButton event:", qEvent(t)
>   File "sbtest.py", line 79, in qEvent
>     if t in qEventDict.keys():
> AttributeError: 'NoneType' object has no attribute 'keys'
> SpinBox event: <type 'NoneType'>
> Traceback (most recent call last):
>   File "sbtest.py", line 96, in event
>     print "SpinBox event:", qEvent(t)
>   File "sbtest.py", line 79, in qEvent
>     if t in qEventDict.keys():
>
> Something is definitely going wrong here.

I think this is just Python and Qt racing each other to tidy up. As the 
behaviour of either isn't formally documented I think it's more a feature 
rather than a bug.

Phil

_______________________________________________
PyKDE mailing list    PyKDE@mats.gmd.de
http://mats.gmd.de/mailman/listinfo/pykde
[prev in list] [next in list] [prev in thread] [next in thread] 

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