[PyKDE] Re: event type bug with sip-4-20031024?
Gerard Vermeulen
gvermeul at grenoble.cnrs.fr
Mon Oct 27 11:37:01 GMT 2003
On Mon, 27 Oct 2003 09:47:09 +0000
Phil Thompson <phil at riverbankcomputing.co.uk> wrote:
> >
> > The SIP-4 API feels great and I can RECOMMEND sip-4 to newbies because
> > handwritten code is much easier to write.
>
> I'm most of the way through adding support for pointers and references to base
> types (eg. int &) so you won't even need the handwritten code below.
>
Wonderful, you're making me superfluous :-)
>
> > While adapting PyQwt for sip-4, I ran into the following warnings
> > indicating that event handlers are getting objects of the wrong type:
> >
> > TypeError: argument 1 of QwtSlider.mouseDoubleClickEvent() has an invalid
> > type TypeError: argument 1 of QwtSlider.mouseDoubleClickEvent() has an
> > invalid type TypeError: argument 1 of QwtSlider.mouseDoubleClickEvent() has
> > an invalid type TypeError: argument 1 of QwtSlider.keyPressEvent() has an
> > invalid type TypeError: argument 1 of QwtSlider.keyPressEvent() has an
> > invalid type TypeError: argument 1 of QwtSlider.keyPressEvent() has an
> > invalid type TypeError: argument 1 of QwtSlider.keyPressEvent() has an
> > invalid type TypeError: argument 1 of QwtSlider.keyPressEvent() has an
> > invalid type
> >
> > And during some of the keyPressEvent()'s I moved the mouse (the events
> > seem to be history dependent).
>
> You mean the messages don't appear consistently? Can you see any pattern at
> all.
>
Yes, there is a pattern: tonight I can add the necessary scaffolding, if you
need it. It looks like, that if a slider has emitted a keyPressEvent, the next
events are also keyPressEvents. I can get events indicating focus change
on mouse moves, etc...
>
> I've noticed that, when running tut14.py and when either the shell is moving
> or you drag the barrel of the cannon around you can sometimes get messages
> about the underlying C++ object being deleted. The object is usually a QRect,
> ie. a simple type (no virtual dtor) that's in existence for a very short
> period of time.
>
> I don't know if the two things are related.
>
[ .. ]
> >
> > class QwtSlider: QwtSliderBase, QwtScaleIf
> > {
> > ...
> > protected:
> > virtual double getValue(const QPoint &);
> > /* virtual */ SIP_PYTUPLE getScrollMode(const QPoint &);
> > %MethodCode
> > // The Python interface takes a QPoint and returns a tuple.
> > int scrollMode;
> > int direction;
> >
> > Py_BEGIN_ALLOW_THREADS
> > sipCpp->getScrollMode(*a0, scrollMode, direction);
> > Py_END_ALLOW_THREADS
> >
> > sipRes = sipBuildResult(&sipIsErr, "(ii)", scrollMode, direction);
> > %End
> > ...
> > };
> >
> > QwtScaleIf and QwtDoubleRange have no event related stuff.
> >
> > Gerard
> >
> > PS: I tried to check if it was related to your latest objmap.c change, and
> > it does not seem to be the case ( but I do not understand why my printf
> > tracing statements didn't print ).
>
> Actually you code above looks wrong. As the handwritten code refers to
> protected methods, you should say...
>
> sipCpp -> sipProtect_getScrollMode(*a0, scrollMode, direction);
>
Thanks.
Actually, I can do that for the concrete derived class, but it does not
compile for the virtual base class:
building 'qwt._qwt' extension
/usr/bin/ccache g++ -pipe -D_REENTRANT -O2 -mcpu=i686 -march=i686 -fPIC -Wall -W -DNDEBUG -DQT_NODEBUG -DQT_THREAD_SUPPORT -Iqwt -Inumpy -Iqwt-sources/include -I/usr/lib/qt321/include -I/home/packer/usr/include/python2.3 -c qwt/sip_qwtQwtSliderBase.cpp -o build/temp.linux-i686-2.3/qwt/sip_qwtQwtSliderBase.o
sip/qwtsliderbase.sip: In function `PyObject
*meth_QwtSliderBase_getScrollMode (PyObject *, PyObject *)':
sip/qwtsliderbase.sip:100: no matching function for call to
`sipQwtSliderBase::sipProtect_getScrollMode (QPoint &, int &, int &)'
sip/qwtsliderbase.sip:96: warning: `int scrollMode' might be used
uninitialized in this function
sip/qwtsliderbase.sip:97: warning: `int direction' might be used
uninitialized in this function
error: command '/usr/bin/ccache' failed with exit status 1
It does not resolve the event bug. Tonight I can dig into it, so .. if you have
suggestions.
Gerard
More information about the PyQt
mailing list