November 26, 2003
In article <bq36c5$17nc$2@digitaldaemon.com>, Berin Loritsch says...
>You can
tell where I've been playing can't you? ;P
> 
>The thing that delegates have
going for them is that they are strongly typed.
>I'm not familiar with Qt's
signal/slots approach, so I can't comment on that.
> 
>Think about it though,
do you really need to subclass a delegate?
>I can't think of a good reason to
myself.

No, I can't and that is pretty much my point.  Why make it an object
in its
own right when you can't even subclass it?  Qt's signal/slots are also
typesafe, but do not have the syntactical overheard of C#'s delegates.

Here
is what they look like:

You define the signal/slots in the header files of
the QObject subclasses like
so.

class Foo: QObject
{
        Q_OBJECT
slots:
	void add( int x, int y );
};

class Bar: QObject
{
Q_OBJECT
signals:
	void calculate( int x, int y );
};

then the slot could
be...

void Foo::add( int x, int y)
{
	print ( x + y );
}

and you'd
connect them like...

	connect( &foo, SIGNAL(calculate(int,int), &bar,
SLOT(add(int,int)) );

and then you'd emit the signal like so...

	emit
calculate( 1, 1 );

and the slot is called.  Of course, you can
connect/disconnect as many slots
to a signal as you wish.  You can also connect
signals to signals.  All very
sane and without the overhead of the delegates.
Of course, I'd like to see a
'+=' or '~=' operator for the connect call, but
other than that I think it is
much nicer...

Here is an overview:
http://www.trolltech.com/products/qt/whitepaper/qt-whitepaper-3.html


November 26, 2003
In article <bq39p8$1d8c$1@digitaldaemon.com>, Adam Treat says...

Sorry about
the odd formatting. I'm using the forum html form direct from the
website.  Not
sure why it is wrapping everything...


November 26, 2003
Ahh, ive seen that before so thought it was some weird client :).

C


"Adam Treat" <Adam_member@pathlink.com> wrote in message news:bq39sk$1df3$1@digitaldaemon.com...
> In article <bq39p8$1d8c$1@digitaldaemon.com>, Adam Treat says...
>
> Sorry about
> the odd formatting. I'm using the forum html form direct from the
> website.  Not
> sure why it is wrapping everything...
>
>


1 2
Next ›   Last »