require 'Qt4'
class MainWindow < Qt::MainWindow
def initialize
super
self.window_title = 'Hello QtRuby v1.0'
resize(200, 100)
button = Qt::PushButton.new('Quit') do
connect(SIGNAL :clicked) { Qt::Application.instance.quit }
end
label = Qt::Label.new(tr '<big>Hello Qt in the Ruby way!</big>')
layout1 = Qt::VBoxLayout.new do
add_widget(label, 0, Qt::AlignCenter)
add_widget(button, 0, Qt::AlignRight)
end
central_widget = layout1
#create_menubar
@statusbar = Qt::StatusBar.new(self)
@statusbar.setObjectName('statusbar')
set_status_bar(@statusbar)
@statusbar.show_message tr("Some text");
end
end
if $0 == __FILE__
a = Qt::Application.new(ARGV)
w = MainWindow.new
w.show
a.exec
end
I am learning qt4 with ruby and have got to a problem that is driving me
crazy. Acording to what I was able to find on Internet
central_widget = layout1
should paint a label and a box in the window. But it doesn't. It doesn't
show anything.
Original c++ documentation points to setCentralWidget( layout1 ) method
but it doesn't exist in ruby Qt4.
It looks like that Qt with ruby is not used a lot. Can anybody confirm
should this work at all or is it a bug.
by
TheR
--
Posted via http://www.ruby-forum.com/.