require 'Qt'
Qt::Application.new(ARGV)do
Qt::Widget.new do
self.window_title='hi!'
label=Qt::Label.new('hello')
self.resize 400,200
button=Qt::PushButton.new('hello SuSE!') do
connect(SIGNAL :clicked) {
label.show
}
end
bye = Qt::PushButton.new('okey, bye') {
connect (SIGNAL :clicked) do
label.hide
end
}
quit = Qt::PushButton.new('quit') do
connect(SIGNAL :clicked){Qt::Application.instance.quit}
end
self.layout=Qt::VBoxLayout.new do
add_widget(button,0,Qt::AlignCenter)
add_widget(bye,0,Qt::AlignRight)
add_widget(quit,0,Qt::AlignRight)
end
show
end
exec
end
先挖个坑,也请大家指出来哪里需要重点解释!