[Kde-bindings] playground/bindings/kimono
Richard Dale
Richard_Dale at tipitina.demon.co.uk
Mon Jun 19 14:04:51 UTC 2006
On Monday 19 June 2006 12:55, Paolo Capriotti wrote:
> On 6/19/06, Richard Dale <Richard_Dale at tipitina.demon.co.uk> wrote:
> > [Q_SLOT]
> > int FooBar(QWidget arg) {
> > ...
> > }
> >
> > Would be a 'int fooBar(QWidget)' in C++, with just the method name
> > lowercased (although that isn't strictly necessary and slot names can
> > start with a upper case letter).
>
> Such a slot would be a 'int fooBar(const QWidget&)'.
Yes, but I think the signature inside the QMetaObject would be 'int
fooBar(QWidget)' with both the 'const' and '&' dropped.
>
> > What type of thing is 'test' here?
> >
> > mytest.Clicked += test;
> >
> > I don't quite see where it comes from.
>
> Here it is:
> > > public void test() {
> > > Console.WriteLine("************ IT WORKS
> > > **************"); }
>
> It is a method. The fact that it is marked with a Q_SLOT attribute is
> irrelevant.
I see, so if you reference a method in C# without brackets it get picked up as
a delegate by the '+=' operator method?
> > I like the look of being able to do something like 'btn.Clicked +=
> > delegate() { Console.WriteLine("Hello world"); }', but rather than have a
> > proxy temporay object I'd prefer we did it be generating a changed
> > QMetaObject on the fly if that was possible. And just using ordinary
> > QObject::connect() calls underneath.
>
> I don't think it's possible. My question is: why don't you like this
> approach? What's wrong with having a temporary object dispatch a
> generic delegate invocation?
Well, because it seems unnecessary to me. We can add a slot or signal with any
type signature we like to the QMetaObject, and then in qt_metacall() we can
intervene and either call a C++ method, or a C# method or even invoke a C#
delegate if that's what we want to do.
> > How long is it before the .NET 2.0 version of mono is released? The
> > various types of ArrayLists could also be done with generics to look more
> > like the C++ originals.
>
> As far as I know, it is released. The compiler for the 2.0 version is
> included in the mono package, and called gmcs, and the runtime works
> with 2.0 assemblies as well.
So I wonder if we should switch to using that if it will be in common use when
kde4 comes out or Qyoto is ready for release if before then?
-- Richard
More information about the Kde-bindings
mailing list