Trolltech Home | Qt-interest Home | Recent Threads | All Threads | Author | Date
All threads index page 2

Qt-interest Archive, March 2002
inheritance problem


Message 1 in thread

Hello

I have got a problem with inheritance!
There is a class A (non qt class) and a class B that inherts A and inherits QObject

class A   //non qt class
{
...
};

class B : public A , QObject
{
  Q_OBJECT
...
}

Then a compiler error follows when he wants to create a staticMetaObject from the class A!
error C2039: 'staticMetaObject' : is not a member of 'pixelinkFramegrabber'

Can you please help me!

thank you 
    Franz


Message 2 in thread

In Qt limitations stands that QObject and derived classes should be first while
multi-inheritance.

Greetz

JK

Helmli Franz wrote:

> Hello
>
> I have got a problem with inheritance!
> There is a class A (non qt class) and a class B that inherts A and inherits QObject
>
> class A   //non qt class
> {
> ...
> };
>
> class B : public A , QObject
> {
>   Q_OBJECT
> ...
> }
>
> Then a compiler error follows when he wants to create a staticMetaObject from the class A!
> error C2039: 'staticMetaObject' : is not a member of 'pixelinkFramegrabber'
>
> Can you please help me!
>
> thank you
>     Franz
>
> --
> List archive and information: http://qt-interest.trolltech.com


Message 3 in thread

Helmli Franz wrote:

> Hello
>
> I have got a problem with inheritance!
> There is a class A (non qt class) and a class B that inherts A and inherits QObject
>
> class A   //non qt class
> {
> ...
> };
>
> class B : public A ,public  QObject
> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<probably here
> {
>   Q_OBJECT
> ...
> }
>
> Then a compiler error follows when he wants to create a staticMetaObject from the class A!
> error C2039: 'staticMetaObject' : is not a member of 'pixelinkFramegrabber'
>
> Can you please help me!
>
> thank you
>     Franz
>
> --
> List archive and information: http://qt-interest.trolltech.com

--
 [ signature omitted ] 

Message 4 in thread

Yes.  QObject needs to be the first thing on your inheritance list.. i
forget the reason for this.. but there is one..

-Calin

On Wed, 6 Mar 2002, Helmli Franz wrote:

> Hello
>
> I have got a problem with inheritance!
> There is a class A (non qt class) and a class B that inherts A and inherits QObject
>
> class A   //non qt class
> {
> ...
> };
>
> class B : public A , QObject
> {
>   Q_OBJECT
> ...
> }
>
> Then a compiler error follows when he wants to create a staticMetaObject from the class A!
> error C2039: 'staticMetaObject' : is not a member of 'pixelinkFramegrabber'
>
> Can you please help me!
>
> thank you
>     Franz
>
> --
> List archive and information: http://qt-interest.trolltech.com
>