qtbindings 4.8.6.3-x86-mingw32 → 4.8.6.4-x86-mingw32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Rakefile +1 -1
- data/bin/2.4/rbrcc.exe +0 -0
- data/bin/2.4/rbuic4.exe +0 -0
- data/bin/2.4/smokeapi.exe +0 -0
- data/bin/2.4/smokedeptool.exe +0 -0
- data/examples/tutorial/t10/cannon.rb +72 -72
- data/examples/tutorial/t10/lcdrange.rb +45 -45
- data/examples/tutorial/t10/t10.rb +55 -55
- data/examples/tutorial/t11/cannon.rb +123 -124
- data/examples/tutorial/t11/lcdrange.rb +45 -45
- data/examples/tutorial/t11/t11.rb +65 -65
- data/examples/tutorial/t12/cannon.rb +157 -158
- data/examples/tutorial/t12/lcdrange.rb +58 -59
- data/examples/tutorial/t12/t12.rb +65 -66
- data/examples/tutorial/t13/cannon.rb +206 -208
- data/examples/tutorial/t13/gamebrd.rb +112 -113
- data/examples/tutorial/t13/lcdrange.rb +59 -60
- data/examples/tutorial/t13/t13.rb +11 -11
- data/examples/tutorial/t14/cannon.rb +262 -263
- data/examples/tutorial/t14/gamebrd.rb +122 -123
- data/examples/tutorial/t14/lcdrange.rb +61 -63
- data/examples/tutorial/t14/t14.rb +11 -11
- data/examples/tutorial/t3/t3.rb +17 -18
- data/examples/tutorial/t4/t4.rb +23 -25
- data/examples/tutorial/t5/t5.rb +35 -37
- data/examples/tutorial/t6/t6.rb +48 -52
- data/examples/tutorial/t7/lcdrange.rb +32 -32
- data/examples/tutorial/t7/t7.rb +40 -42
- data/examples/tutorial/t8/cannon.rb +37 -38
- data/examples/tutorial/t8/lcdrange.rb +45 -45
- data/examples/tutorial/t8/t8.rb +43 -43
- data/examples/tutorial/t9/cannon.rb +44 -45
- data/examples/tutorial/t9/lcdrange.rb +46 -46
- data/examples/tutorial/t9/t9.rb +43 -43
- data/lib/2.4/libqtruby4shared.dll +0 -0
- data/lib/2.4/libsmokebase.dll +0 -0
- data/lib/2.4/libsmokeqtcore.dll +0 -0
- data/lib/2.4/libsmokeqtdeclarative.dll +0 -0
- data/lib/{2.1 → 2.4}/libsmokeqtgui.dll +0 -0
- data/lib/2.4/libsmokeqthelp.dll +0 -0
- data/lib/2.4/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.4/libsmokeqtnetwork.dll +0 -0
- data/lib/2.4/libsmokeqtopengl.dll +0 -0
- data/lib/2.4/libsmokeqtscript.dll +0 -0
- data/lib/2.4/libsmokeqtsql.dll +0 -0
- data/lib/2.4/libsmokeqtsvg.dll +0 -0
- data/lib/2.4/libsmokeqttest.dll +0 -0
- data/lib/2.4/libsmokeqtuitools.dll +0 -0
- data/lib/2.4/libsmokeqtwebkit.dll +0 -0
- data/lib/2.4/libsmokeqtxml.dll +0 -0
- data/lib/2.4/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.4/qtdeclarative.so +0 -0
- data/lib/2.4/qtruby4.so +0 -0
- data/lib/2.4/qtscript.so +0 -0
- data/lib/2.4/qttest.so +0 -0
- data/lib/2.4/qtuitools.so +0 -0
- data/lib/2.4/qtwebkit.so +0 -0
- data/lib/Qt4.rb +119 -111
- data/lib/qtbindings_version.rb +2 -2
- data/qtbindings.gemspec +18 -18
- data/qtbindingsnative.gemspec +19 -19
- metadata +38 -115
- data/bin/2.0/rbrcc.exe +0 -0
- data/bin/2.0/rbuic4.exe +0 -0
- data/bin/2.0/smokeapi.exe +0 -0
- data/bin/2.0/smokedeptool.exe +0 -0
- data/bin/2.1/rbrcc.exe +0 -0
- data/bin/2.1/rbuic4.exe +0 -0
- data/bin/2.1/smokeapi.exe +0 -0
- data/bin/2.1/smokedeptool.exe +0 -0
- data/bin/2.2/rbrcc.exe +0 -0
- data/bin/2.2/rbuic4.exe +0 -0
- data/bin/2.2/smokeapi.exe +0 -0
- data/bin/2.2/smokedeptool.exe +0 -0
- data/bin/2.3/rbrcc.exe +0 -0
- data/bin/2.3/rbuic4.exe +0 -0
- data/bin/2.3/smokeapi.exe +0 -0
- data/bin/2.3/smokedeptool.exe +0 -0
- data/lib/2.0/libqtruby4shared.dll +0 -0
- data/lib/2.0/libsmokebase.dll +0 -0
- data/lib/2.0/libsmokeqtcore.dll +0 -0
- data/lib/2.0/libsmokeqtdeclarative.dll +0 -0
- data/lib/2.0/libsmokeqtgui.dll +0 -0
- data/lib/2.0/libsmokeqthelp.dll +0 -0
- data/lib/2.0/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.0/libsmokeqtnetwork.dll +0 -0
- data/lib/2.0/libsmokeqtopengl.dll +0 -0
- data/lib/2.0/libsmokeqtscript.dll +0 -0
- data/lib/2.0/libsmokeqtsql.dll +0 -0
- data/lib/2.0/libsmokeqtsvg.dll +0 -0
- data/lib/2.0/libsmokeqttest.dll +0 -0
- data/lib/2.0/libsmokeqtuitools.dll +0 -0
- data/lib/2.0/libsmokeqtwebkit.dll +0 -0
- data/lib/2.0/libsmokeqtxml.dll +0 -0
- data/lib/2.0/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.0/qtdeclarative.so +0 -0
- data/lib/2.0/qtruby4.so +0 -0
- data/lib/2.0/qtscript.so +0 -0
- data/lib/2.0/qttest.so +0 -0
- data/lib/2.0/qtuitools.so +0 -0
- data/lib/2.0/qtwebkit.so +0 -0
- data/lib/2.1/libqtruby4shared.dll +0 -0
- data/lib/2.1/libsmokebase.dll +0 -0
- data/lib/2.1/libsmokeqtcore.dll +0 -0
- data/lib/2.1/libsmokeqtdeclarative.dll +0 -0
- data/lib/2.1/libsmokeqthelp.dll +0 -0
- data/lib/2.1/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.1/libsmokeqtnetwork.dll +0 -0
- data/lib/2.1/libsmokeqtopengl.dll +0 -0
- data/lib/2.1/libsmokeqtscript.dll +0 -0
- data/lib/2.1/libsmokeqtsql.dll +0 -0
- data/lib/2.1/libsmokeqtsvg.dll +0 -0
- data/lib/2.1/libsmokeqttest.dll +0 -0
- data/lib/2.1/libsmokeqtuitools.dll +0 -0
- data/lib/2.1/libsmokeqtwebkit.dll +0 -0
- data/lib/2.1/libsmokeqtxml.dll +0 -0
- data/lib/2.1/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.1/qtdeclarative.so +0 -0
- data/lib/2.1/qtruby4.so +0 -0
- data/lib/2.1/qtscript.so +0 -0
- data/lib/2.1/qttest.so +0 -0
- data/lib/2.1/qtuitools.so +0 -0
- data/lib/2.1/qtwebkit.so +0 -0
- data/lib/2.2/libqtruby4shared.dll +0 -0
- data/lib/2.2/libsmokebase.dll +0 -0
- data/lib/2.2/libsmokeqtcore.dll +0 -0
- data/lib/2.2/libsmokeqtdeclarative.dll +0 -0
- data/lib/2.2/libsmokeqtgui.dll +0 -0
- data/lib/2.2/libsmokeqthelp.dll +0 -0
- data/lib/2.2/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.2/libsmokeqtnetwork.dll +0 -0
- data/lib/2.2/libsmokeqtopengl.dll +0 -0
- data/lib/2.2/libsmokeqtscript.dll +0 -0
- data/lib/2.2/libsmokeqtsql.dll +0 -0
- data/lib/2.2/libsmokeqtsvg.dll +0 -0
- data/lib/2.2/libsmokeqttest.dll +0 -0
- data/lib/2.2/libsmokeqtuitools.dll +0 -0
- data/lib/2.2/libsmokeqtwebkit.dll +0 -0
- data/lib/2.2/libsmokeqtxml.dll +0 -0
- data/lib/2.2/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.2/qtdeclarative.so +0 -0
- data/lib/2.2/qtruby4.so +0 -0
- data/lib/2.2/qtscript.so +0 -0
- data/lib/2.2/qttest.so +0 -0
- data/lib/2.2/qtuitools.so +0 -0
- data/lib/2.2/qtwebkit.so +0 -0
- data/lib/2.3/libqtruby4shared.dll +0 -0
- data/lib/2.3/libsmokebase.dll +0 -0
- data/lib/2.3/libsmokeqtcore.dll +0 -0
- data/lib/2.3/libsmokeqtdeclarative.dll +0 -0
- data/lib/2.3/libsmokeqtgui.dll +0 -0
- data/lib/2.3/libsmokeqthelp.dll +0 -0
- data/lib/2.3/libsmokeqtmultimedia.dll +0 -0
- data/lib/2.3/libsmokeqtnetwork.dll +0 -0
- data/lib/2.3/libsmokeqtopengl.dll +0 -0
- data/lib/2.3/libsmokeqtscript.dll +0 -0
- data/lib/2.3/libsmokeqtsql.dll +0 -0
- data/lib/2.3/libsmokeqtsvg.dll +0 -0
- data/lib/2.3/libsmokeqttest.dll +0 -0
- data/lib/2.3/libsmokeqtuitools.dll +0 -0
- data/lib/2.3/libsmokeqtwebkit.dll +0 -0
- data/lib/2.3/libsmokeqtxml.dll +0 -0
- data/lib/2.3/libsmokeqtxmlpatterns.dll +0 -0
- data/lib/2.3/qtdeclarative.so +0 -0
- data/lib/2.3/qtruby4.so +0 -0
- data/lib/2.3/qtscript.so +0 -0
- data/lib/2.3/qttest.so +0 -0
- data/lib/2.3/qtuitools.so +0 -0
- data/lib/2.3/qtwebkit.so +0 -0
- data/lib/qtbindings_qt_version.rb +0 -2
data/examples/tutorial/t5/t5.rb
CHANGED
@@ -1,37 +1,35 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
-
|
4
|
-
require 'Qt'
|
5
|
-
|
6
|
-
class MyWidget < Qt::Widget
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
quit
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
slider =
|
18
|
-
slider.
|
19
|
-
|
20
|
-
|
21
|
-
connect(
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
layout
|
26
|
-
layout.addWidget(
|
27
|
-
layout.addWidget(
|
28
|
-
layout
|
29
|
-
|
30
|
-
end
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
widget.show
|
37
|
-
app.exec
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
+
|
4
|
+
require 'Qt'
|
5
|
+
|
6
|
+
class MyWidget < Qt::Widget
|
7
|
+
def initialize()
|
8
|
+
super
|
9
|
+
quit = Qt::PushButton.new('Quit')
|
10
|
+
quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold))
|
11
|
+
|
12
|
+
connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
|
13
|
+
|
14
|
+
lcd = Qt::LCDNumber.new(2)
|
15
|
+
|
16
|
+
slider = Qt::Slider.new(Qt::Horizontal)
|
17
|
+
slider.range = 0..99
|
18
|
+
slider.value = 0
|
19
|
+
|
20
|
+
connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
|
21
|
+
connect(slider, SIGNAL('valueChanged(int)'),
|
22
|
+
lcd, SLOT('display(int)'))
|
23
|
+
|
24
|
+
layout = Qt::VBoxLayout.new
|
25
|
+
layout.addWidget(quit)
|
26
|
+
layout.addWidget(lcd)
|
27
|
+
layout.addWidget(slider)
|
28
|
+
setLayout(layout)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
app = Qt::Application.new(ARGV)
|
33
|
+
widget = MyWidget.new
|
34
|
+
widget.show
|
35
|
+
app.exec
|
data/examples/tutorial/t6/t6.rb
CHANGED
@@ -1,52 +1,48 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
-
|
4
|
-
require 'Qt'
|
5
|
-
|
6
|
-
class LCDRange < Qt::Widget
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
slider =
|
12
|
-
slider.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
layout
|
18
|
-
layout.addWidget(
|
19
|
-
layout
|
20
|
-
|
21
|
-
end
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
layout
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
app = Qt::Application.new(ARGV)
|
50
|
-
widget = MyWidget.new
|
51
|
-
widget.show
|
52
|
-
app.exec
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
+
|
4
|
+
require 'Qt'
|
5
|
+
|
6
|
+
class LCDRange < Qt::Widget
|
7
|
+
def initialize(parent = nil)
|
8
|
+
super
|
9
|
+
lcd = Qt::LCDNumber.new(2)
|
10
|
+
slider = Qt::Slider.new(Qt::Horizontal)
|
11
|
+
slider.range = 0..99
|
12
|
+
slider.value = 0
|
13
|
+
|
14
|
+
lcd.connect(slider, SIGNAL('valueChanged(int)'), SLOT('display(int)'))
|
15
|
+
|
16
|
+
layout = Qt::VBoxLayout.new
|
17
|
+
layout.addWidget(lcd)
|
18
|
+
layout.addWidget(slider)
|
19
|
+
setLayout(layout)
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class MyWidget < Qt::Widget
|
24
|
+
def initialize()
|
25
|
+
super
|
26
|
+
quit = Qt::PushButton.new('Quit')
|
27
|
+
quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold))
|
28
|
+
connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
|
29
|
+
|
30
|
+
grid = Qt::GridLayout.new
|
31
|
+
|
32
|
+
for row in 0..3
|
33
|
+
for column in 0..3
|
34
|
+
grid.addWidget(LCDRange.new, row, column)
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
layout = Qt::VBoxLayout.new
|
39
|
+
layout.addWidget(quit)
|
40
|
+
layout.addLayout(grid)
|
41
|
+
setLayout(layout)
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
app = Qt::Application.new(ARGV)
|
46
|
+
widget = MyWidget.new
|
47
|
+
widget.show
|
48
|
+
app.exec
|
@@ -1,32 +1,32 @@
|
|
1
|
-
#!/usr/bin/ruby -w
|
2
|
-
require 'Qt'
|
3
|
-
|
4
|
-
class LCDRange < Qt::Widget
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
end
|
1
|
+
#!/usr/bin/ruby -w
|
2
|
+
require 'Qt'
|
3
|
+
|
4
|
+
class LCDRange < Qt::Widget
|
5
|
+
signals 'valueChanged(int)'
|
6
|
+
slots 'setValue(int)'
|
7
|
+
|
8
|
+
def initialize(parent = nil)
|
9
|
+
super
|
10
|
+
lcd = Qt::LCDNumber.new(2)
|
11
|
+
|
12
|
+
@slider = Qt::Slider.new(Qt::Horizontal)
|
13
|
+
@slider.range = 0..99
|
14
|
+
@slider.value = 0
|
15
|
+
|
16
|
+
connect(@slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)'))
|
17
|
+
connect(@slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'))
|
18
|
+
|
19
|
+
layout = Qt::VBoxLayout.new
|
20
|
+
layout.addWidget(lcd)
|
21
|
+
layout.addWidget(@slider)
|
22
|
+
setLayout(layout)
|
23
|
+
end
|
24
|
+
|
25
|
+
def value()
|
26
|
+
@slider.value()
|
27
|
+
end
|
28
|
+
|
29
|
+
def setValue(value)
|
30
|
+
@slider.setValue(value)
|
31
|
+
end
|
32
|
+
end
|
data/examples/tutorial/t7/t7.rb
CHANGED
@@ -1,42 +1,40 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
-
|
4
|
-
require 'Qt'
|
5
|
-
|
6
|
-
|
7
|
-
class MyWidget < Qt::Widget
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
widget.show
|
42
|
-
app.exec
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
$VERBOSE = true; $:.unshift File.dirname($0)
|
3
|
+
|
4
|
+
require 'Qt'
|
5
|
+
require_relative 'lcdrange.rb'
|
6
|
+
|
7
|
+
class MyWidget < Qt::Widget
|
8
|
+
def initialize(parent = nil)
|
9
|
+
super(parent)
|
10
|
+
quit = Qt::PushButton.new('Quit')
|
11
|
+
quit.setFont(Qt::Font.new('Times', 18, Qt::Font::Bold))
|
12
|
+
|
13
|
+
connect(quit, SIGNAL('clicked()'), $qApp, SLOT('quit()'))
|
14
|
+
|
15
|
+
grid = Qt::GridLayout.new
|
16
|
+
previousRange = nil
|
17
|
+
for row in 0..3
|
18
|
+
for column in 0..3
|
19
|
+
lcdRange = LCDRange.new(self)
|
20
|
+
grid.addWidget(lcdRange, row, column)
|
21
|
+
if previousRange != nil
|
22
|
+
connect(lcdRange, SIGNAL('valueChanged(int)'),
|
23
|
+
previousRange, SLOT('setValue(int)'))
|
24
|
+
end
|
25
|
+
previousRange = lcdRange
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
layout = Qt::VBoxLayout.new
|
30
|
+
layout.addWidget(quit)
|
31
|
+
layout.addLayout(grid)
|
32
|
+
setLayout(layout)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
app = Qt::Application.new(ARGV)
|
37
|
+
|
38
|
+
widget = MyWidget.new
|
39
|
+
widget.show
|
40
|
+
app.exec
|
@@ -1,38 +1,37 @@
|
|
1
|
-
require 'Qt'
|
2
|
-
|
3
|
-
class CannonField < Qt::Widget
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
end
|
1
|
+
require 'Qt'
|
2
|
+
|
3
|
+
class CannonField < Qt::Widget
|
4
|
+
signals 'angleChanged(int)'
|
5
|
+
slots 'setAngle(int)'
|
6
|
+
|
7
|
+
def initialize(parent = nil)
|
8
|
+
super
|
9
|
+
@currentAngle = 45
|
10
|
+
setPalette(Qt::Palette.new(Qt::Color.new(250, 250, 200)))
|
11
|
+
setAutoFillBackground(true)
|
12
|
+
end
|
13
|
+
|
14
|
+
def setAngle(degrees)
|
15
|
+
if degrees < 5
|
16
|
+
degrees = 5
|
17
|
+
elsif degrees > 70
|
18
|
+
degrees = 70
|
19
|
+
end
|
20
|
+
if @currentAngle == degrees
|
21
|
+
return
|
22
|
+
end
|
23
|
+
@currentAngle = degrees
|
24
|
+
repaint()
|
25
|
+
emit angleChanged(@currentAngle)
|
26
|
+
end
|
27
|
+
|
28
|
+
def paintEvent(event)
|
29
|
+
p = Qt::Painter.new(self)
|
30
|
+
p.drawText(200, 200, "Angle = %d" % @currentAngle)
|
31
|
+
p.end()
|
32
|
+
end
|
33
|
+
|
34
|
+
def sizePolicy()
|
35
|
+
return Qt::SizePolicy.new(Qt::SizePolicy::Expanding, Qt::SizePolicy::Expanding)
|
36
|
+
end
|
37
|
+
end
|
@@ -1,45 +1,45 @@
|
|
1
|
-
require 'Qt'
|
2
|
-
|
3
|
-
class LCDRange < Qt::Widget
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
end
|
1
|
+
require 'Qt'
|
2
|
+
|
3
|
+
class LCDRange < Qt::Widget
|
4
|
+
signals 'valueChanged(int)'
|
5
|
+
slots 'setValue(int)', 'setRange(int, int)'
|
6
|
+
|
7
|
+
def initialize(parent = nil)
|
8
|
+
super
|
9
|
+
lcd = Qt::LCDNumber.new(2)
|
10
|
+
@slider = Qt::Slider.new(Qt::Horizontal)
|
11
|
+
@slider.range = 0..99
|
12
|
+
@slider.value = 0
|
13
|
+
connect(@slider, SIGNAL('valueChanged(int)'), lcd, SLOT('display(int)'))
|
14
|
+
connect(@slider, SIGNAL('valueChanged(int)'), SIGNAL('valueChanged(int)'))
|
15
|
+
|
16
|
+
layout = Qt::VBoxLayout.new
|
17
|
+
layout.addWidget(lcd)
|
18
|
+
layout.addWidget(@slider)
|
19
|
+
setLayout(layout)
|
20
|
+
|
21
|
+
setFocusProxy(@slider)
|
22
|
+
end
|
23
|
+
|
24
|
+
def value()
|
25
|
+
@slider.value()
|
26
|
+
end
|
27
|
+
|
28
|
+
def setValue(value)
|
29
|
+
@slider.setValue(value)
|
30
|
+
end
|
31
|
+
|
32
|
+
def range=(r)
|
33
|
+
setRange(r.begin, r.end)
|
34
|
+
end
|
35
|
+
|
36
|
+
def setRange(minVal, maxVal)
|
37
|
+
if minVal < 0 || maxVal > 99 || minVal > maxVal
|
38
|
+
qWarning("LCDRange::setRange(#{minVal},#{maxVal})\n" +
|
39
|
+
"\tRange must be 0..99\n" +
|
40
|
+
"\tand minVal must not be greater than maxVal")
|
41
|
+
return
|
42
|
+
end
|
43
|
+
@slider.setRange(minVal, maxVal)
|
44
|
+
end
|
45
|
+
end
|