Bauduin Raphael wrote:

> Hi,
> 
> Just testing QtRuby right now, so being a real newbie at it....
> 
> I'm wondering how I should use .ui files generated with Qtdesigner:
> by loading it dynamically like this
> 
> w = QUI::WidgetFactory.create "form1.ui"
> 
> or by passing it through rbuic and using the ruby code generated?
> 
> In the first case, I don't know how to access elements in the ui, for
> example a list box in the form, and in the second case the file needs a
> transformation step.
> 
> Any advice and example welcome.
I would use the rbuic tool to generate ruby code. If you use the '-x'
option, rbuic adds a top level stub so you can run it straightaway:

$ rbuic -x form1.ui -o form1.rb
$ ruby form1.rb

The WidgetFactory way is more useful for C++ programs because it means you
can change the UI without having to recompile and link it all. But with
ruby you don't need to do that. 

You can pass a 'connector object' Qt::Object instance to
QUI::WidgetFactory.create and it will connect up slots you define in it to
any custom slots inside the ui file. To access a ui element like a list
box, you would need to define a custom slots connected to suitable signals
in the list box.

-- Richard