[PyQt] Method returning QList<const TYPE *>

Lorenzo Masini rugginoso at develer.com
Thu Mar 24 15:51:45 GMT 2011


Hi everyone,
I'm using sip 4.10.5 and PyQt 4.7.4.
If a method returns a QList of const pointers, it seems that the const
keyword is discarded.
Make gives me this error:
--
/usr/share/sip/PyQt4/QtCore/qlist.sip: In function ‘int
convertTo_QList_0111Item(PyObject*, void**, int*, PyObject*)’:
/usr/share/sip/PyQt4/QtCore/qlist.sip:195: error: cannot convert
‘QList<Item*>*’ to ‘QList<const Item*>*’ in assignment
/usr/share/sip/PyQt4/QtCore/qlist.sip: In function ‘PyObject*
convertFrom_QList_0111Item(void*, PyObject*)’:
/usr/share/sip/PyQt4/QtCore/qlist.sip:138: error: invalid conversion
from ‘const Item*’ to ‘Item*’
--

Here's the sip file generating the error (it's almost identical to the
header file):
---
%Module Proof

%ModuleHeaderCode
#include "proof.h"
%End

%Import QtCore/QtCoremod.sip

class Item {
%TypeHeaderCode
#include "proof.h"
%End

public:
    Item(int i);
};

class Proof {
%TypeHeaderCode
#include "proof.h"
%End

public:
    Proof();
    ~Proof();

    QList<const Item *> items() const;
};
---

Cheers
--
Lorenzo Masini
Develer srl




More information about the PyQt mailing list