take ownership of QApplication in tutorials
[lqt.git] / test / t4.lua
blob4b7d9398f9e7e50ea36fc2a12cd5370894cd92ce
1 #!/usr/bin/lua
3 require'qtgui'
5 local new_MyWidget = function(...)
6 local this = QWidget.new(...)
7 local quit = QPushButton.new(QString.new'Quit', this)
8 this:setFixedSize(200, 120)
9 quit:setGeometry(62, 40, 75, 30)
10 quit:setFont(QFont.new(QString.new'Times', 18, 75))
11 QObject.connect(quit, '2clicked()', QCoreApplication.instance(), '1quit()')
12 return this
13 end
15 app = QApplication.new(select('#', ...), {...})
16 app.__gc = app.delete -- take ownership of object
18 widget = new_MyWidget()
19 widget:show()
21 app.exec()