Alle domenica 4 marzo 2007, Chris ha scritto:
changing the output of rbuic4? Everything I have tried results in
segfaults and superclass mismatch errors.
I’ve done this:
- create a custom_widget_base.ui with designer (suppose the form name is
CustomWidgetBase and that it contains a single push button,
- run rbuic4 on the file, getting custom_widget_base.rb. This file
class called Ui_CustomWidgetBase, from which a class called
contained in a module called Ui, is derived.
- create the file custom_widget.rb with the following contents:
require ‘custom_widget_base.rb’ #require the rbuic4-generated file
class CustomWidget < Qt::Widget
def initialize parent=nil
super #call Qt::Widget constructor
@base.setupUI self #this is where the widget construction happen
Qt::MessageBox.information self, ‘App’, ‘The button has been
As to connecting to custom slots directly from Qt designer, I haven’t
able to find out how to create custom slots in the designer. While in
version there was a dialog to do that, it seems to have disappeared in
new version. Even the examples in the designer manual only show
existing signal to an existing slot.
I hope this helps.