mkottman/lqt — Issue #15: no custom slots/events with QUiLoader loaded widgets
Author: nicksabaka
Created: 2011-12-20 22:01:58+00:00
State: open

Hi, I use QUiLoader like this:

local loader = QUiLoader.new()
local uifile = QFile.new( "main.ui" )
uifile:open( { 'ReadOnly' } )
local mainWidget = loader:load( uifile )
w1 = mainWidget:findChild( "MyPushButton" )
------------------
widget is loaded, isWidgetType() returns true, but now both approaches described in examples for signal/slots and events seem not work for w1.

i.e. app crashes after this:
w1:__addmethod( "test()", function() print(1) end )
w1:connect( "2clicked()", w1, "1test()" )

with error: bad argument #3 to 'connect' (no such receiver method: 'test()')
( i dont see test() in methods list after __addmethod)

function w1:closeEvent( e ) print(1) end
this one is just silently passing with no result for widget's behaviour. Am I doing something wrong or do those approaches work only with .new() created widgets?

p.s. as a workaround I have to create new empty QWidget and create slots for it - in this case all works fine