[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Need help with qtruby application

meruby

3/16/2005 7:28:00 PM

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

3 Answers

Caleb Tennis

3/16/2005 9:20:00 PM

0

> @s1 = Qt::Splitter.new(Qt.Vertical, nil)

Change 'nil' to 'self'.

Caleb



meruby

3/16/2005 9:52:00 PM

0

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.

Caleb Tennis wrote:
> > @s1 = Qt::Splitter.new(Qt.Vertical, nil)
>
> Change 'nil' to 'self'.
>
> Caleb

JimK

8/28/2009 6:28:00 PM

0

On Fri, 28 Aug 2009 08:40:38 -0700, "Sweetbac"
<sweetbacz@scbglobal.net> wrote:

>I've never understood why JimK attracts so much vitriolic sentiment
>from deadheads. Is he one of the great posters players of all time? Of
>course not. Is he WEREO? Certainly not. Did he ever claim to be? Not
>that I'm aware of. He's a working poster who, as far as I can tell,
>gives you his best effort whenever he's here.
>As far as his GD "connection", I guess he likes the Dead and enjoys
>their music. Is that some kind of crime? Are we supposed to
>think less of him because he likes to play Dead music? I just don't
>see what the problem is here.
>

Well, I consider myself one of the great poster players of all time. I
played a few posters the other day that you wouldn't believe! Any time
you wanna match posters with me, you just let me know, big boy.
There's NO problem here!

JimK