Need help with qtruby application

M

meruby

I am trying to create a splitter and 1 button in each splitter.
Everything runs fine, but I can see only status bar, no splitter or
buttons. What is wrong with it?

***********************************************************************

require 'Qt'

class Splitter < Qt::Widget
def initialize(parent, name='test', t=0)
super(parent, name, t)
end
end

class MainWindow < Qt::MainWindow
def initialize()
super
@s1 = Qt::Splitter.new(Qt.Vertical, nil)
@s2 = Qt::Splitter.new(Qt.Horizontal, @s1)

@sp1 = Splitter.new(@s2)
hello = Qt::pushButton.new("First button", @sp1)
@sp2 = Splitter.new(@s2)
hello = Qt::pushButton.new("Second button", @sp2)
self.statusBar().message('Ready', 2000)
end
end

app = Qt::Application.new(ARGV)
win = MainWindow.new
win.showMaximized
app.setMainWidget(win)
app.exec()
exit
 
M

meruby

Thanks Caleb, I had to add: self.setCentralWidget(@s1)
and change nil to self as you suggested.

I was confused between Widget and MainWindow inherited class.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

"Segmentation fault" with QtRuby 2
QtRuby : constructor optional parameter 2
QtRuby - Error 0
QtRuby Questions: Why does 2
qtruby problems 4
Qt problems 3
[ANN] QtRuby 1.4.7 12
install_qtruby_on_mac 7

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,144
Latest member
KetoBaseReviews
Top