You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have fought with the need to call super virtual methods too, however I found no clean and concise way of doing it (I would also need to export protected virtual functions, which I could do, but do not want to).
Currently, you can use this to call the virtual method with original parameters:
function foo:keyPressEvent(e)
-- do something
error(SUPER) -- not nice, but...
end
As for the second point, you have to look a bit deeper:
function foo:keyPressEvent(e)
if e:key() == Qt.Key.Key_Enter then
-- enter was pressed
end
end
That means you have to enter the enum name between Qt and value. I use the following function to quickly find an enum I'm looking for:
function findEnum(name)
name = name:lower()
require 'qtcore'
require 'qtgui'
for k,v in pairs(Qt) do
for kk,vv in pairs(v) do
if type(kk) == 'string' and kk:lower():match(name) then
print('Qt.' .. k .. '.' .. kk .. ' = ' .. vv)
end
end
end
end
Hi.
Is it possible to call the base class method from an overloaded virtual method somehow? Such as,
This would be necessary for overloading some event handlers.
Also, binding the global namespace enums somehow would be useful. Such as,
The text was updated successfully, but these errors were encountered: