6 local LCD_Range
= function(...)
7 local this
= QWidget
.new(...)
9 local lcd
= QLCDNumber
.new()
10 lcd
:setSegmentStyle
'Filled'
12 local slider
= QSlider
.new
'Horizontal'
13 slider
:setRange(0, 99)
16 QObject
.connect(slider
, '2valueChanged(int)', lcd
, '1display(int)')
18 local layout
= QVBoxLayout
.new()
20 layout
:addWidget(slider
)
21 this
:setLayout(layout
)
25 local new_MyWidget
= function(...)
26 local this
= QWidget
.new(...)
28 local quit
= QPushButton
.new(QString
.new
'Quit')
29 quit
:setFont(QFont
.new(QString
.new
'Times', 18, 75))
30 QObject
.connect(quit
, '2clicked()', QCoreApplication
.instance(), '1quit()')
32 local grid
= QGridLayout
.new()
35 local lcdrange
= LCD_Range()
36 grid
:addWidget(lcdrange
, row
, column
)
40 local layout
= QVBoxLayout
.new()
41 layout
:addWidget(quit
)
42 layout
:addLayout(grid
)
43 this
:setLayout(layout
)
47 app
= QApplication
.new(1 + select('#', ...), {arg
[0], ...})
48 app
.__gc
= app
.delete
-- take ownership of object
50 widget
= new_MyWidget()