[Qt-interest] Inheritance limitations

John McClurkin jwm at nei.nih.gov
Tue Oct 13 14:27:59 CEST 2009


Scott Sibley wrote:
> 
> Probably true. I just thought of a solution to my issue though. You see, 
> I needed a QObject slot, but a different method for each different class 
> deriving A. So the following might do it.
> 
> class A: public QObject { // The reason A needs to be a QObject is I 
> have some properties for QScript to access.
>     Q_OBJECT
> 
>     public slots:
>     void aMethod();
> };
> 
> class B: public A {
>     public:
>     void aMethod(); // Class C would provide its own aMethod as well.
> }
> 
> Of course I haven't tested this yet. I don't see why it wouldn't work.

Well, that's the way I do it and it works for me.



More information about the Qt-interest-old mailing list