ruby with root + qt

From: Riemann, Robert <robert.riemann_at_physik.hu-berlin.de>
Date: Thu, 23 Jul 2009 17:00:50 +0200


Hi all,

I tried to translate the python+qt example from the userguide to ruby.

I had to add one modification (line 17, actually in comments) to get it working, but the program doesn't behave as well as the python-version. Closing the TBrowser and restarting with another click on the button doesn't work. In some cases windows freeze. Without the fork-command the qt-window freezes.

Maybe it's a bug. Does anyone have a better idea how to make it with ruby?

Greets Robert

Versions:
Root v5.20/00
Ruby ruby 1.8.7 (2008-08-11 patchlevel 72) [x86_64-linux] opensuse 11.1 with kde 4.2.4 and ruby-kde4 4.2.4

Code with highlighting on pastie.org: http://pastie.org/548613 Code without highlighting here:

#!/usr/bin/env ruby
$KCODE = 'u' # use utf8 encoding of this file

require 'Qt4'
require 'libRuby'

class CustomWidget < Qt::PushButton

  slots :browse

  def initialize( label )
    super( label )
  end

  def browse
    tb = TBrowser.new
    # fork do gApplication.Run end
 end

end

a = Qt::Application.new(ARGV) # create an application object w = CustomWidget.new( 'Start TBrowser' ) # create an instance of our self-made CustomWidget
Qt::Object.connect( w, SIGNAL( :clicked ), w, SLOT( :browse ) ) w.show # show our widget
a.exec # run the application Received on Thu Jul 23 2009 - 17:03:51 CEST

This archive was generated by hypermail 2.2.0 : Thu Jul 23 2009 - 23:50:01 CEST