[Kde-bindings] const_missing method in ruby 1.8

Richard Dale Richard_Dale at tipitina.demon.co.uk
Tue Aug 5 10:35:40 UTC 2003


On Tuesday 05 August 2003 10:37, Alexander Kellett wrote:
> On Tue, Aug 05, 2003 at 10:39:58AM +0100, Richard Dale wrote:
> > > but, quick question nevertheless, would this
> > > be modifications to Qt.rb or Qt.cpp?, i didn't
> > > really understand the do_method_missing. i'll
> > > try to read more code tonight. haven't read
> > > all that much up till now.
> >
> > It probably won't involve a change to do_method_missing in Qt.rb. It
> > might just be a matter of adding this in Qt.cpp, Init_Qt():
>
> realized this shortly after sending the email and reading
> the code ;-) hadn't really looked at Qt.cpp at all yet.
>
> >     rb_define_singleton_method(qt_base_class, "const_missing", (VALUE (*)
> > (...)) class_method_missing, -1);
> >     rb_define_singleton_method(qt_module, "const_missing", (VALUE (*)
> > (...)) module_method_missing, -1);
> >     rb_define_method(qt_base_class, "const_missing", (VALUE (*) (...))
> > method_missing, -1);
> >
> > Just add three new overrides for 'const_missing' which point to the same
> > C functions as the three 'method_missing' equivalents.
>
> after readingthe code i tried all three of them seperately but
> not yet together. i'll give this a try now :)
Ok - I'll leave you to it - please check it in, if you think it works. I just 
tried this in t4.rb:

quit.setFont(Qt::Font.new("Times", 18, Qt::Font::Bold))

and it worked fine.

> > > so. the error
> > >    builder.rb:17: [BUG] Cannot handle 'QCanvasItemList' as return-type
> > > of QCanvas::collisions is really quite understandable.
> > > though a nice error message would be nicer, which
> > > brings me to another tangent.
> >
> > I think it would be a good idea to try the same thing in PerlQt, and see
> > how its error messages come out.
>
> yes. i shall try with PerlQt-3.006 tonight. good idea.
> i'll try to fill in some more of the error handling code
> in Qt.cpp tonight in fact. it makes development quite
> slow as it requires heavy reading of Qt docs just to find
> out exactly what you did to make it go "[BUG]" ;-)
>
> > > i'm guessing that some sort of generic base QValueList[Iterator]
> > > object handler needs to be created?, or, is there a minor
> > > bug in the bindings generation that stops this case maybe?
> > >
> > > i'm guessing its also not possible to use it as a parameter
> > > therefore, which is pretty limiting as a large number of
> > > functions use QPtrLists's, QValueList's etc.
> >
> > We'd need specific marshallers for each concrete instance of a QValueList
> > I think, in handlers.cpp. Here are the existing marshallers, so there are
> > some QValueList ones - we would need some more like that for
> > QCanvasItemList etc.
>
> this seems quite evil especially considering that imo
> kalyptus could just be creating bindings for the actual
> iterator objects. any reason against that? it seems like
> a far better way that the current system of writing a
> handler for each commonly used type. or, maybe just a
> big set of macros to automate the type handling would be
> enough rather than a smoke extension.
You wouldn't want to see the iterator classes in ruby code though - surely the 
value lists should just be normal ruby arrays?

I'll try and do the TODO list today - I think we've discussed enough stuff 
that needs doing for a bit though..

-- Richard



More information about the Kde-bindings mailing list