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

List:       pykde
Subject:    Re: [PyKDE] SIP and typedefs in signals
From:       Phil Thompson <phil () riverbankcomputing ! co ! uk>
Date:       2006-12-20 16:41:22
Message-ID: 200612201641.23041.phil () riverbankcomputing ! co ! uk
[Download RAW message or body]

On Monday 18 December 2006 7:34 pm, Gerard Vermeulen wrote:
> Hi,
>
> moc does not expand typedefs in signals but sip does.
> Therefore I needed a hack to wrap the following header code:
>
> --- start C++ header code ---
> typedef QPointF QwtDoublePoint;
>
> class QWT_EXPORT QwtPlotPicker: public QwtPicker
> {
>     Q_OBJECT
>     ...
> signals:
>     // Here, moc produces code containing QwtDoublePoint and not QPointF.
>     void selected(const QwtDoublePoint &pos);
> };
> --- end C++ header code ---
>
> --- start SIP declaration ---
> // The C++ library declares
> // typedef QPointF QwtDoublePoint;
> // but that does not work in SIP (Python crashes, when using the typedef).

When does it crash? When you call connect()? When the signal is delivered?

> // However the following SIP declaration
> class QwtDoublePoint: QPointF
> {
> %TypeHeaderCode
> #include <qpoint.h>
> %End // %TypeHeaderCode
> };
> // does work.
>
> class QwtPlotPicker: QwtPicker
> {
> %TypeHeaderCode
> #include <qwt_plot_picker.h>
> %End // %TypeHeaderCode
>     ...
> signals:
>     void selected(const QwtDoublePoint&);
>     // void selected(const QRectF&); without typedef may have worked
> before, // but not with SIP-4.5.x.
> };
> --- end SIP declaration ---
>
> Is it possible (or worthwhile) to make SIP behave like moc for such cases?

I don't think that this is the problem. SIP supports the use of typedefs in 
signal arguments - see sipFindSigArgType() in siplib.c. As they are not used 
very much I think the problem is more likely to be a bug in that function.

Phil

_______________________________________________
PyKDE mailing list    PyKDE@mats.imk.fraunhofer.de
http://mats.imk.fraunhofer.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