[PyQt] Pyqt 5.1.1, problem when passing enum as parameter (assetion fails)

Julien Pauty julien.pauty at gmail.com
Mon Oct 21 14:14:23 BST 2013


Hi,

Using version 5.1.1 of PyQt and 4.15.3 of sip. Qt 5.1

When passing an enum as an argument to a method, the following assert
fails:

siplib.c:8356: sip_api_can_convert_to_type: Assertion `(((td)->td_flags &
0x0007) == 0x0000) || (((td)->td_flags & 0x0007) == 0x0002)' failed.


With PyQt 5.0.1 we did not have this problem. Is there something special to
do with enums with PyQt 5.1.1 ?

Here is a small example to reproduce the problem:


Header:
class QDockWorkspace
:    public QWidget
{    Q_OBJECT
    public :
        QDockWorkspace(QWidget* parent,Qt::DockWidgetAreas allowedAreas);
        virtual ~QDockWorkspace();

    private :
        Qt::DockWidgetAreas m_allowedAreas;
};

cc file:
QDockWorkspace::QDockWorkspace(QWidget* parent,Qt::DockWidgetAreas
allowedAreas)
:    QWidget(parent)
,    m_allowedAreas(allowedAreas)
{}

QDockWorkspace::~QDockWorkspace()
{}

Sip:
class QDockWorkspace : QWidget
{
%TypeHeaderCode
#include "qdockworkspace.hh"
%End
    public :
        QDockWorkspace(QWidget* parent /TransferThis/ );//,
Qt::DockWidgetAreas allowedAreas );
        virtual ~QDockWorkspace();
};

The python part:
import PyQt5.Qt as qt
application = qt.QApplication([])
import myModule
myModule.QDockWorkspace2(None,0)

Cheers,

Julien
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20131021/fd640861/attachment.html>


More information about the PyQt mailing list