From: Stefano Crocco Date: 2009-01-16T03:11:47+09:00 Subject: Re: Using qui rather than rbuic for qtdesigner .ui files Alle giovedì 15 gennaio 2009, David Brunell ha scritto: > Stefano Crocco wrote: > > require 'Qt' > > require 'qui' > > > > class MainWidget < Qt::Widget > > > > slots 'test()' > > > > def initialize > > @widget = QUI::WidgetFactory.create "sampledialog.ui" > > self.layout = Qt::VBoxLayout.new > > self.layout.add_widget @widget > > connect @widget.child('testButton'), SIGNAL('clicked()'), self, > > SLOT('test()') > > end > > > > def test > > puts "test button clicked" > > end > > > > end > > > > app = Qt::Application.new ARGV > > w = MainWidget.new > > w.show > > a.connect(a, SIGNAL('lastWindowClosed()'), a, SLOT('quit()')) > > a.exec > > Many thanks for your kind reply. I get the following error when running > your suggested code: > > quitest2.rb:10:in `method_missing': undefined method `layout=' for > > :MainWidget (NoMethodError) > > I somewhat understand this error, but upon commenting out the two > self.layout lines, I then get the following error: > > quitest2.rb:12:in `method_missing': super: no superclass method > `connect'(NoMethodError) Sorry, I forgot one line. The initialize method should be: def initialize super # this is the new part @widget = QUI::WidgetFactory.create "sampledialog.ui" self.layout = Qt::VBoxLayout.new self.layout.add_widget @widget connect @widget.child('testButton'), SIGNAL('clicked()'), self, SLOT('test()') end This will solve the second problem and most likely also the first. If the firs remains, try replacing self.layout = set_layout Stefano