Gente;
Desarrollando con Qt he descubierto q no soporta herencia multiple (de
2 QObjects),
y necesito utilizar herencia multiple a modo de
interfaces (clase abstracta pura) con Slots. Basicamente es;
Clase interface : public QObject{
Q_OBJECT
public slots:
virtual void slot1() = 0;
}
Clase tipoA : public QObject{
Q_OBJECT
}
Clase tipoB: public tipoA, public interface{
Q_OBJECT
public slots:
virtual void slot1();
}
Esto obviamente no funciona, y no se si existe alguna receta para
solucionar este problema.
http://doc.qt.nokia.com/4.6/moc.html
Multiple Inheritance Requires QObject to Be First
If you are using multiple inheritance, moc assumes that the first
inherited class is a subclass of QObject.
Also, be sure that only the first inherited class is a QObject.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Si se te ocurre alguna solución no estándar me gustaría saberla.
1>.\main.cpp(33): Warning: Class tipoB inherits from two QObject
subclasses tipoA and interface. This is not supported!
2010/12/7 Ing. Esteban D. Papp <esteba...@gmail.com>:
> --
> ¿Eres miembro de "CyC++ Buenos Aires" verdad? Si no lo eres, has recibido
> este mesaje por error.
> En caso de duda visita "http://groups.google.com/group/cppba"
Q_OBJECT
public slots:
virtual void slot1() = 0;
};
class tipoA : public QObject {
};
class tipoB : public tipoA, public interface{
public:
virtual void slot1();
};