[PyQt] Incorrect base for wrapped class

Kelly Burkhart kelly.burkhart at gmail.com
Tue Jul 3 16:05:31 BST 2007


Greetings,

I am trying to wrap QAbstractTableModel.  When I instantiate my code,
it shows an incorrect base class:

>>> from PyQt4 import QtGui, QtCore
>>> from ecn.gui.log_view_model_base import LogViewModelBase
>>> print LogViewModelBase.__base__
<class 'PyQt4.QtCore.QProcess'>


LogViewModelBase is a sip wrapper of a trivial class derived from
QAbstractTableModel.  I have no idea how QProcess gets chosen as a
base (incidentally, if I derive from QAbstractItemMode, QIODevice is
chosen as base).

Can anyone provide a hint as to what I am doing wrong or failing to
specify?  Thanks!

Qt 4.3.0
sip 4.6
PyQt-x11-commercial-4.2
SuSE Linux Desktop 10

.h:

#include <QAbstractTableModel>

class LogViewModelBase : public QAbstractTableModel {
public:
   LogViewModelBase( QObject *parent=0 );
   virtual ~LogViewModelBase();

private:

   // Prevent instances from being copied
   LogViewModelBase( const LogViewModelBase & );
   LogViewModelBase &operator=( const LogViewModelBase & );
};

.cpp:

#include "log_view_model_base.h"

//--------------------------------------------------------------------------------------------------
LogViewModelBase::LogViewModelBase( QObject *parent )
   : QAbstractTableModel(parent)
{}

//--------------------------------------------------------------------------------------------------
LogViewModelBase::~LogViewModelBase()
{
}


.sip:

%Module ecn_py_log_view_model_base 0

%Import QtCore/QtCoremod.sip

class LogViewModelBase : QAbstractTableModel
{

%TypeHeaderCode
#include "log_view_model_base.h"
%End

public:
   LogViewModelBase( QObject *parent /TransferThis/ = 0 );
   virtual ~LogViewModelBase();

private:
   // prevent instances from being copied
   LogViewModelBase( const LogViewModelBase & );
};


More information about the PyQt mailing list