summaryrefslogtreecommitdiffstats
path: root/qtruby/rubylib/examples/qt-examples/hello/main.rb
blob: 1b31055181d27cd8a4977d0536f7b0b22b0be1f8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
#!/usr/bin/env ruby

require 'Qt'
require 'hello'

a = TQt::Application.new(ARGV)
s = ''

s = ARGV[0..ARGV.size-1].join(' ') if ARGV.length

if (s.empty?)
	s = 'Hello, World'
end

h = Hello.new(s)
h.setCaption('QtRuby says hello')
h.connect(h, TQ_SIGNAL('clicked()'), a, TQ_SLOT('quit()'))
h.setFont(TQt::Font.new('times', 32, TQt::Font.Bold))	# default font
h.setBackgroundColor(TQt::white)				# default bg color
a.setMainWidget(h)
h.show

a.exec