Forum: Ruby Qt4 designer, custom slots and rbuic4

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
64881a11ab1d91338d8bc97c9953800f?d=identicon&s=25 Chris (Guest)
on 2007-03-04 16:54
Hello everyone,

I just started looking at trying to write some Qt stuff in ruby.  I
whipped up a quick widget in designer to see how the whole process
works.  When it came time to connect a button to a custom slot I got
stuck.  The docs on the internet that deal with designer are all qt3
based. The search button on this forums website is broken, so sorry if
this has been brought up already.

Has anybody had any luck implementing custom slots in ruby without
changing the output of rbuic4?  Everything I have tried results in
segfaults and superclass mismatch errors.
C40020a47c6b625af6422b5b1302abaf?d=identicon&s=25 Stefano Crocco (crocco)
on 2007-03-04 17:18
(Received via mailing list)
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,
named 'push_button')
* run rbuic4 on the file, getting custom_widget_base.rb. This file
contains a
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

  slots 'button_pressed()'

  def initialize parent=nil
    super #call Qt::Widget constructor
    @base.setupUI self #this is where the widget construction happen

  def button_pressed
    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
the Qt3
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
connecting an
existing signal to an existing slot.

I hope this helps.

64881a11ab1d91338d8bc97c9953800f?d=identicon&s=25 Christopher Tasma (christophertasma)
on 2007-03-04 19:19
> I hope this helps.
> Stefano

Yes it did.  Thank you Stefano, everything is working now.

This topic is locked and can not be replied to.