[Kde-bindings] Qtruby -- assorted question

Han Holl han.holl at pobox.com
Sun Oct 10 13:48:13 UTC 2004


On Sunday 10 October 2004 15:25, Richard Dale wrote:
> To get the list of parents, you can't use this:
>
>     obj = self
>     while obj.respond_to?(:parent)
>       obj = obj.parent
>       STDERR.puts("P: #{obj.class} #{obj.object_id}")
>     end
>
> Because QtRuby depends on using method_missing() to trap ruby method calls,
> and divert them to the Smoke library. And so respond_to? will always be
> false. Instead do something like this:
>
>     obj = self.parent
>     while !obj.nil?
>         STDERR.puts("P: #{obj.class} #{obj.object_id}")
>         obj = obj.parent
>     end
>

Ah yes, Thanks for the explanation.
Now I also understand why
  puts Qt::Widget.instance_methods(false).sort.join("\n")
doesn't produce a single instance method for class Qt::Widget
  

>
> Well, I have this in my docs for QTabWidget:
>
> virtual void addTab ( QWidget * child, const QString & label )
> virtual void addTab ( QWidget * child, const QIconSet & iconset, const

Yes, I must have been looking at QTabBar::addTab. So many windows open, so 
little time...

I've got another segfault for you by the way: (stupid programmer error, but 
still):
require 'Qt'

class ContainerGrid < Qt::Widget
  def sizeHint
## next line should return a Qt::Size, not an integer
    100
  end
end
 a  = Qt::Application.new(ARGV)
 w = ContainerGrid.new
 a.mainWidget = w
 w.show
 a.exec

Cheers,

Han Holl



More information about the Kde-bindings mailing list