Jeff Meininger wrote:
> I have some normal C++ classes: FooThing, BarThing, and BazThing. They
> all inherit AbstractThing.
> I have a QObject with a slot:
> void doSomething(const AbstractThing &thingy);
> I have various QObjects with signals:
> void fooThingCreated(const FooThing &foo);
> void barThingChanged(const BarThing &bar);
> void bazThingClicked(const BazThing &baz);
> If I try to connect these, I get "Object::connect: Incompatible
> sender/receiver arguments". Is there a way to tell Qt meta info system
> about the inheritance relationship so this will work?
> I realize I can create some kind of ThingWrapper and have all of my
> signals and slots deal with those, but I'd prefer to use the Things
> themselves if it's possible.
I dont have a reasonable solution to your problem, but what if you use a
pointer to AbstractThing in your signals and slots? You can then check
in your slot at runtime, whether this pointer points to a fooThing,
barThing or bazThing by means of QObject::isA(). Your fooThing, barThing
and bazThing would have to inherit QObject though.
To unsubscribe - send a mail to qt-interest-request@xxxxxxxxxxxxx with
"unsubscribe" in the subject or the body.
List archive and information: http://lists.trolltech.com/qt-interest/