From: Stefano Crocco Date: 2009-01-21T18:55:39+09:00 Subject: Re: Using qui rather than rbuic for qtdesigner .ui files Alle lunedì 19 gennaio 2009, David Brunell ha scritto: > One other question...what about Qt4?  I think I need rbuic4 if I am > going to pre-compile the ui.  Is there a qui4 for dynamic loading? The following should work using a recent svn revision from kdebindings. However, it doesn't because findChild fails. I think it's a bug and I'll try to contact the developers to require 'Qt4' require 'qtuitools' class Dlg < Qt::Dialog slots 'test()' def initialize parent = nil super file = Qt::File.new File.expand_path('~/temp/test_ui.ui') file.open(Qt::File::ReadOnly) loader = Qt::UiLoader.new @widget = loader.load file, self file.close self.layout = Qt::VBoxLayout.new self layout.add_widget @widget @close_btn = @widget.findChild(Qt::PushButton, 'close_btn') @test_btn = @widget.findChild(Qt::PushButton, 'test_btn') connect @close_btn, SIGNAL('clicked()'), Qt::Application.instance, SLOT('close()') connect @test_btn, SIGNAL('clicked()'), self, SLOT('test()') end def test puts "testing" end end app = Qt::Application.new ARGV dlg = Dlg.new dlg.exec app.exec Stefano