qt-interest@trolltech.com
[Top] [All Lists]

Re: inheritance of emitted argument types

Subject: Re: inheritance of emitted argument types
From: Bernd Brandstetter
Date: Wed, 19 Jul 2006 18:40:14 +0200
Hi,

On Wednesday 19 July 2006 17:01, 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);

Why don't you simply define your signals as
void fooThingCreated(const AbstractThing &foo);
void barThingChanged(const AbstractThing &bar);
void bazThingClicked(const AbstractThing &baz);

That way the signal/slot arguments match and of course you can still pass 
your Foo/Bar/BazThing objects as parameters without casting.

Regards,
Bernd

--
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/

<Prev in Thread] Current Thread [Next in Thread>