tdzl2003 / luaqt

Lua(JIT) wrapper for QT
Other
30 stars 15 forks source link

Meta-language design #2

Open tdzl2003 opened 10 years ago

tdzl2003 commented 10 years ago

What do you think about this?

require("QtWidgets")
local ui_LoginWindow = loadstring(require("uic").run("loginwindow.ui"))()

-- @class LoginWindow
-- @extend QWidget
local LoginWindow = {}

-- @constructor __init__
-- @argument QWidget*
-- @end constructor
function LoginWindow:__init__(parent)
    self.ui = ui_LoginWindow.setupUi(self)
    self:connect(self.ui.btn_Login, "2clicked()", "1doLogin()")
end

-- @signal logined
-- @return void
-- @end signal
function LoginWindow:logined()
end

-- @slot doLogin
-- @return void
-- @end slot
function LoginWindow:doLogin()
    self:logined()
end

-- @end class

return LoginWindow
tdzl2003 commented 10 years ago

A sample for overload.

-- @slot draw
-- @name drawText
-- @argument QString
-- @return void
function Window:drawText()
end

-- @slot draw
-- @name drawBitmap
-- @argument QBitmap
-- @return void
function Window:drawBitmap()
end
tdzl2003 commented 10 years ago

Base meta-language was done.

But there's some problem with overload. Keep working.