[PySide] [shiboken]how to make shiboken implement pure virtual function?

48 views
Skip to first unread message

机械唯物主义 : linjunhalida

unread,
Dec 31, 2010, 3:02:09 AM12/31/10
to pys...@lists.openbossa.org
ok, still my pysideqwt project, I'm wrapping QwtData,
in QwtData: http://qwt.sourceforge.net/qwt__data_8h-source.html

00047 class QWT_EXPORT QwtData
00048 {
00049 public:
00050 QwtData();
00051 virtual ~QwtData();
00052
00054 virtual QwtData *copy() const = 0;
00055
00057 virtual size_t size() const = 0;
00058
00064 virtual double x(size_t i) const = 0;
00070 virtual double y(size_t i) const = 0;
00071
00072 virtual QwtDoubleRect boundingRect() const;
00073
00074 protected:
00078 QwtData &operator=(const QwtData &);
00079 };

and xml typesystem:

<object-type name="QwtData">
</object-type>

and qwtdata_wrapper:

class QwtDataWrapper : public QwtData
{
public:
QwtDataWrapper();
virtual QRectF boundingRect() const;
virtual QwtData * copy() const;
virtual ~QwtDataWrapper();
};

didn't implement those pure virtual function, what's wrong?
or should I send more information?
_______________________________________________
PySide mailing list
PyS...@lists.openbossa.org
http://lists.openbossa.org/listinfo/pyside

Hugo Parente Lima

unread,
Jan 3, 2011, 6:00:29 AM1/3/11
to pys...@lists.openbossa.org

The generator probably doesn't know what is "size_t" due to a missing include
file.

If I'm correct, find and add the include file or add size_t as primitive type on
your typesystem using the tag:

<primitive-type name="size_t" default-constructor="0" target-lang-api-
name="PyLong" />

Regards.

--
Hugo Parente Lima
INdT - Instituto Nokia de Tecnologia

signature.asc

Grissiom

unread,
Aug 11, 2011, 1:05:39 PM8/11/11
to Hugo Parente Lima, pys...@lists.openbossa.org

Thank you very much for your answer. It's loong time from linjunhalida
stopped working on pysideqwt. So I'm going to try to continue with it.
I got the same problem when I try qt4examples/SimpleDemo.py:

./SimpleDemo.py:89: RuntimeWarning: Invalid return value in function
QwtData.size, expected size_t, got int

How to deal with it?

Besides, it seems in PyQwt it's safe to do something like
QwtPlotCurve.setData(SimpleData(math.sin, 100)). But pysideqwt will
segfault if we don't keep a reference to SimpleData(math.sin, 100). Is
there any better way to deal with it?

Thanks very much.

--
Cheers,
Grissiom
_______________________________________________
PySide mailing list
PyS...@lists.pyside.org
http://lists.pyside.org/listinfo/pyside

Hugo Parente Lima

unread,
Aug 11, 2011, 1:52:57 PM8/11/11
to Grissiom, pys...@lists.openbossa.org

Add size_t or std::size_t (depends how it was written on C++ header file) as
primitive type on your type system, e.g:

<primitive-type name="std::size" target-lang-api-name="PyInt" />


> Besides, it seems in PyQwt it's safe to do something like
> QwtPlotCurve.setData(SimpleData(math.sin, 100)). But pysideqwt will
> segfault if we don't keep a reference to SimpleData(math.sin, 100). Is
> there any better way to deal with it?
>
> Thanks very much.

--

signature.asc
Reply all
Reply to author
Forward
0 new messages