A package providing interfaces to a number of essential Qt Graphical User Interface classes.

This package also provides QtLua specific classes. Class QtLuaPainter gives you the ability draw simple graphics using well known postscript-like operators. Graphic output can be sent to an arbitrary widget, to a PS or PDF file, or to a printer. Class QtLuaListener gives you the ability to listen to events on arbitrary widgets

For instance, the convenient function qtwidget.newwindow creates a main window and returns its descriptor.

  require 'qtwidget'
  w=qtwidget.newwindow(400,300,"Some QWidget")
Drawing is easily achieved using Postscript-like operators.
  w:moveto(0,0); w:curveto(0,300,400,0,400,300); w:closepath()
  w:setcolor("red"); w:fill(false)
  w:setcolor("blue"); w:setlinewidth(5); w:stroke()
Text output is of course supported using show.
  w:moveto(90,40)
  w:setcolor("black")
  w:setfont(qt.QFont{serif=true,italic=true,size=20})
  w:show("The Quick Brown Fox...")
Alpha-transparency works as well.
  w:rectangle(50,50,300,200)
  w:setcolor(1,1,0,.5)
  w:fill()
Finally you can capture Qt events using the qt.connect function,
  qt.connect(w.listener,
       'sigMousePress(int,int,QByteArray,QByteArray,QByteArray)',
       function(...) print("MousePress",...) end );
and you can erase everything with
  w:showpage()

Subsections

  1. High Level Interface
  2. Qt Classes
  3. QtLua Classes