[PyKDE] PyQt QClipboard bugs.

Phil Thompson phil at river-bank.demon.co.uk
Tue May 21 09:52:01 BST 2002

James Grant wrote:
> Hi,
> Firstly, this piece of code in qclipboard.sip needs to change from:
>         void setData(QMimeSource *);
> to this:
>         void setData(QMimeSource * /Transfer/);
> Otherwise you get messages like this all the time from Qt:
>         QMimeSource::~QMimeSource: clipboard data deleted!
> Because you're deleting the clipboard when you shouldn't be.


> Secondly, when you call the data() method of QClipboard you get a QMimeSource
> object returned. But the problem with this is that this class contains pure
> virtual methods in C++, such as encodedData(QString):
>         QByteArray QMimeSource::encodedData ( const char * ) const [pure virtual]
> which means we end up with errors like this in python:
>     dataStr = str(data.encodedData("application/x-blah"))
> AttributeError: encodedData
> My guess is that the data() method of QClipboard should be returning an object
> of the actual type, i.e. QStoredDrag.

I don't think QMimeSource provides the necessary type information to
"upcast" like that. I think the problem is that maybe SIP doesn't
properly support pure virtual methods.

Do you have a simple test script you can send me?


More information about the PyQt mailing list