references returned should not be managed by Lua
[lqt.git] / test / t4.lua
blobf8c3053defab2183a9dedcf5b1af978fa89b4f94
1 #!/usr/bin/lua
3 require'qtcore'
4 require'qtgui'
6 local new_MyWidget = function(...)
7 local this = QWidget.new(...)
8 local quit = QPushButton.new(QString.new'Quit', this)
9 this:setFixedSize(200, 120)
10 quit:setGeometry(62, 40, 75, 30)
11 quit:setFont(QFont.new(QString.new'Times', 18, 75))
12 QObject.connect(quit, '2clicked()', QCoreApplication.instance(), '1quit()')
13 return this
14 end
16 app = QApplication.new(1 + select('#', ...), {arg[0], ...})
17 app.__gc = app.delete -- take ownership of object
19 widget = new_MyWidget()
20 widget:show()
22 app.exec()