[Kde-bindings] Qt::Object.connect for ruby-blocks

kelko kelko at anakrino.de
Mon Sep 4 14:35:46 UTC 2006


> Yes, it should be allowed to do everything a normal method in
> @other_method could do, and the only difference being that the
> block doesn't have a name, and it could access local variables in
> the calling environment too.

Ok.
So, a new version of the connect2Block-Method. This Version is
enabling the developer to use connect-calls like

Qt::Object.connect(a, SIGNAL("clicked()"), b) do
	doSome()
end

the code as it is attached doesn't support calls like

Qt::Object.connect(a, SIGNAL("clicked()")) do
	doSome()
end

anymore, for it needs a target. the last connect would need to look like

Qt::Object.connect(a, SIGNAL("clicked()"), self) do
	doSome()
end

But as I understood Richard right he will modify the C-Code of the
connect-method so if it is called with only 2 arguments it automaticly
adds the caller of the method als third argument. If that would be
done the developers could use either of the three connect-calls:

Qt::Object.connect(src, SIGNAL(:sig), trg, SLOT(:slot))

Qt::Object.connect(src, SIGNAL(:sig), trg) do
	blockCode
end

Qt::Object.connect(src, SIGNAL(:sig) do
	blockCode
end

If a target is given the block is executed inside that context.
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: connect2Block.rb
URL: <http://mail.kde.org/pipermail/kde-bindings/attachments/20060904/e4852d43/attachment.ksh>


More information about the Kde-bindings mailing list