[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: lqt: Qt bindings update
- From: Mauro Iazzi <mauro.iazzi@...>
- Date: Sun, 18 Jan 2009 18:23:27 +0100
2009/1/18 Anders Backman <andersb@cs.umu.se>:
> Again, about binding other C++ API:s.
> I have browsed the code, trying to bind some sample API:s, one issue is the
> include structure of Qt is rather odd...
>
> When generating cpp-files, the lua files adds
> #include "libname"
> and
> #include <libname>
> where libname is the:
> cpptoxml libname <rest of the arguments>
> I know, that Qt is sort of not so strict when it comes to include
> directories.
> A common rule is that classes in namespace Y is included as:
> <Y/yclassA> (or <Y/yclassA.h/.hpp>
>
> Comments?
the bindings generator (generator.lua) accepts a -i flag, which tells
the headers it must include.
CMakeList.txt is qt specific and uses this flag in the way you
describe. If you bind other libraries you have to supply the correct
include files with the -i option. I have just committed the
possibility of using a header with <...> syntax.
> On Wed, Aug 27, 2008 at 7:05 PM, Peter Kümmel <syntheticpp@gmx.net> wrote:
>>
>> 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
>
>
>
> --
> __________________________________________
> Anders Backman, CTO Algoryx Simulation AB
> Uminova Science Park, Box 7973, SE-907 19
> Umeå, Sweden
> anders@algoryx.se http://www.algoryx.se
> Cell: +46-70-392 64 67
>