lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


Here an update on the current status of lqt, a Qt binding,
http://repo.or.cz/w/lqt.git

Now we bind on Linux and Windows these Qt libraries:

QtCore
QtGui
QtNetwork
QtOpenGL
QtScript -- executing JavaScript from Lua  ;)
QtSvg
QtWebKit
QtXml

The build process is now much simpler:
cmake ..\lqt
make


Basic functionality is tested but much more tests are needed.


Some examples:

1. Hello World:

require'qtgui'

app = QApplication.new(0, {})
app.__gc = app.delete -- take ownership of object

hello = QPushButton.new(QString.new("Hello World!"))
hello:show()

app.exec()



2. Show www.lua.org:

require'qtcore'
require'qtgui'
require'qtwebkit'

app = QApplication.new(0,{})
app.__gc = app.delete -- take ownership of object

webView = QWebView.new()
webView:setUrl(QUrl.new(QString.new('http://www.lua.org')))
webView:show()

app.exec()



3. Unicode

require'qtcore'

umlaut = QString.new('Ö')
utf8 = umlaut:toUtf8()
print(string.byte(utf8, 1, #utf8))



4. Evaluate JavaScript

require'qtcore'
require'qtscript'

engine = QScriptEngine.new()
result = engine:evaluate(QString.new('p=function(){print(\"Hello World\");}; p();'))



More examples or tests are welcome!

Best regards,
Peter