[Qt-interest] Inheritance limitations

Jason H scorp1us at yahoo.com
Tue Oct 13 00:01:40 CEST 2009


If A inherits QObject, why inherit it again?

class B: public A {
    Q_OBJECT
};

Is all you should need. Right?





________________________________
From: Scott Sibley <sisibley at gmail.com>
To: qt-interest at trolltech.com
Sent: Mon, October 12, 2009 5:31:46 PM
Subject: [Qt-interest] Inheritance limitations

I get the following warning with these two classes. I think I'm learning to cope with it (I'm rewriting a pygtk app in C++ and QT, where I just dropped signals wherever I liked), but was curious why there's the limitation.

[starlon at localhost tmp]$ moc-qt4 -I/usr/include/QtCore -o moc_test.cc test.h
test.h:11: Warning: Class B inherits from two QObject subclasses QObject and A. This is not supported!

// test.h
class A: public virtual QObject {
    Q_OBJECT
};

class B: public virtual QObject, public A {
    Q_OBJECT
};


      
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.qt-project.org/pipermail/qt-interest-old/attachments/20091012/d71816a7/attachment.html 


More information about the Qt-interest-old mailing list