PDA

View Full Version : Q_INTERFACES with classes having a copy constructor



Mike
31st October 2008, 12:40
Hi all,

I have a problem which I have no answer for....
I have created a class which is derived from QObject, and does implement an interface. For this class I do have added a copy constructor so that I can use it for Qt's collection classes like QList etc...
The relevant part of the header file does look like this:


class CVO_StreamInfo : public QObject, public IVO_StreamInfoBase
{
Q_OBJECT
Q_INTERFACES ( IVO_StreamInfoBase IVO_DataObject );

public:
CVO_StreamInfo(QObject *parent = 0);
~CVO_StreamInfo();
//
CVO_StreamInfo(const CVO_StreamInfo& streamInfo);
CVO_StreamInfo& operator=(const CVO_StreamInfo& streamInfo);
//
IVO_DataObject::ObjectVersion objectVersion() const;
quint32 hash() const;
//
...


The class does work perfectly, and the code compiles. However the compiler does throw a warning:
"class IVO_StreamInfoBase should be explicitly initialized in the copy constructor..."

But since the IVO_StreamInfoBase is an interface with all pure virtual methods with no constructor available, what is it that I have to do to get rid of this warning?

Any idea?
The source of the copy constructor method does look like this:


CVO_StreamInfo::CVO_StreamInfo(const CVO_StreamInfo& streamInfo) : QObject(0)
{
// Make a copy of all properties
...



Thanks,
Michael