Pierre Brengard wrote:
> Christian Szegedy wrote:
> 
>> Christian Boos wrote:
>>
>>> (mainly it is difficult to override constructors and
>>> virtual methods).
>>

I hoped, it would be difficult, but possible...
I would have liked to see a solution, not an explanation, why it is
impossible.

> for exemple, you cannot overload (or implement - whatever is the word) 
> the virtual method
> 
>    virtual void drawSplitter ( QPainter *, QCOORD x, QCOORD y, QCOORD w, 
> QCOORD h )
> 
> In fact, if you do it (say write a method like
> 
>    def drawSplitter painter, x, y, w, h
> 
>        ...
> 
>    end


> 
> , it does nothing because the C++ implementation calls the C++ method and
> *not* the ruby method.

It is quite clear (You can't manipulate the virtual method table in the runtime.)
The only solution I see is that the wrapper overloads ALL virtual functions and
the overloaded functions decide whether they call their "super" methods or not
dynamically. Of course, this would worsen the runtime considerably.
As far as I know the current qt-binding does not use this trick. So, I would
also believe that it is impossible to do this in the current binding.

> Has someone a clue to overload virtual methods for ruby-Qt3 ?

The solution above could work. I think one should update the SWIG-ruby to behave this
way, at least optionally...

An optimized version of the above is to use inherit from each class a overridable
one if the class in question had virtual functions. You could decide: you want to use
the "unoverridable" but faster one, or the slower but more flexible class.
The drawback of this would be a more complicated interface.

Another proposal for the new Qt3 binding:

I would like to be able add Proc objects to blocks in a simple way.
(Without using signalConnect). E.g I would like to  be able to write:



onClicked do |item|
   ...
end

instead of:

connect(self,QSIGNAL("clicked(QListViewItem*)"),"slot_clicked")
def slot_clicked(item)
   ...
end

Best regards, Christian