Merge pull request #52 from gogoprog/patch-1
[lqt/mk.git] / README.md
blob9773a5304efb2507b7f3ee9e15073f2bb868d5d4
1 Overview
2 ========
4 lqt is a [Lua](http://www.lua.org) binding to the [Qt framework](http://qt.nokia.com).
5 It is an automated binding generated from the Qt headers, and covers almost
6 all classes and methods from supported Qt modules.
8 For more info, check the documentation, [mailing list](http://groups.google.com/group/lqt-bindings) or contact the authors:
10  * Michal Kottman michal.kottman@gmail.com
11  * Mauro Iazzi mauro.iazzi@gmail.com
12  * Peter Kümmel syntheticpp@gmx.net
14 Features
15 --------
17 * automatically generated from Qt headers - remains up-to-date even with as Qt progresses
18 * supported modules: QtCore, QtGui, QtNetwork, QtXml, QtXmlPatterns, QtWebKit, QtOpenGL, QtSql, QtSvg, QtUiTools
19 * high API coverage - only a minimum of methods are not available
20 * C++/Qt features available:
21   * method overloads
22   * virtual methods (including abstract methods)
23   * multiple inheritance
24   * you can store additional Lua values in userdata - they act like Lua tables
25   * several overloaded operators are supported
26   * chosen templated classes are available, like `QList<QString>`
27   * signal/slot mechanism - you can define custom slots in Lua
28   * `QObject` derived objects are automatically cast to correct type thanks to Qt metaobject system
29   * implicit conversion - i.e. write Lua strings where QString is expected, or numbers instead of QVariant
30 * optional memory management - you can let the Lua GC destroy objects, or let Qt parent/child management do the work
32 History
33 -------
35 ## lqt 0.9
37 * Public beta, most issues and API stabilized
39 Building lqt
40 ------------
42 Pre-compiled Windows binaries of lqt compiled against Qt 4.7 compatible
43 with Lua for Windows [are available](https://github.com/mkottman/lqt/downloads),
44 on other systems you need:
46 * Lua 5.1
47 * [CMake](http://www.cmake.org/cmake/resources/software.html)
48 * Qt and headers, on Ubuntu you need to install the `libqt4-dev` package
50 You can get the latest source of lqt from https://github.com/mkottman/lqt .
51 When you have the sources, create an out-of-source build directory
52 (where the binaries will be built, I often use `build` or `/dev/shm`).
53 Then, use CMake to generate the Makefile and run `make` as usual:
55     mkdir build; cd build
56     cmake ..
57     make -j4 # use parallel build with your number of cores/processors
59 The generated Lua binding libraries are created in the `lib` directory,
60 you can copy them to your `LUA_CPATH`.
62 Usage
63 -----
65 A quick example of "Hello World!" button with signal/slot handling:
67     require 'qtcore'
68     require 'qtgui'
70     app = QApplication.new(select('#',...) + 1, {'lua', ...})
72     btn = QPushButton.new("Hello World!")
73     btn:connect('2pressed()', function(self)
74         print("I'm about to close...")
75         self:close()
76     end)
77     btn:setWindowTitle("A great example!")
78     btn:resize(300,50)
79     btn:show()
81     app.exec()
83 For more examples, check out the `test` folder and the `doc`
84 folder for documentation on detailed usage - memory management,
85 signal/slot handling, virtual method overloading, etc. Also, have
86 a look at the [examples](https://github.com/mkottman/lqt/wiki/Examples)
87 and feel free to add your own!
89 License
90 -------
92 Copyright (c) 2007-2009 Mauro Iazzi
93 Copyright (c) 2008-2009 Peter Kümmel
94 Copyright (c) 2010-2011 Michal Kottman
96 Permission is hereby granted, free of charge, to any person
97 obtaining a copy of this software and associated documentation
98 files (the "Software"), to deal in the Software without
99 restriction, including without limitation the rights to use,
100 copy, modify, merge, publish, distribute, sublicense, and/or sell
101 copies of the Software, and to permit persons to whom the
102 Software is furnished to do so, subject to the following
103 conditions:
105 The above copyright notice and this permission notice shall be
106 included in all copies or substantial portions of the Software.
108 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
109 EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
110 OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
111 NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
112 HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
113 WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
114 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
115 OTHER DEALINGS IN THE SOFTWARE.