dherring
unread,Mar 14, 2011, 2:47:52 AM3/14/11Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to eql-user
I started playing with EQL for real, and qoverride is being
difficult. Details first, question at the end.
Here's the documentation for qoverride in ecl_fun.cpp.
cl_object qoverride(cl_object l_obj, cl_object l_name, cl_object
l_fun) {
/// args: (object name function)
/// Sets a Lisp function to be called on a virtual Qt method. If
the Lisp function returns <code>NIL</code>, the default Qt method will
be called afterwards.<br><br>To remove a function, pass <code>NIL</
code> instead of the function argument.
/// (qoverride edit "keyPressEvent(QKeyEvent*)" (lambda (ev)
(print (qfun ev "key")) nil))
Here's the implementation of the override I tried using (from src/gen/
_main_q_classes.h). From the documentation above, I thought that
(lambda (...) nil) would result in the default createEditor() being
called. Looking at the code, that's not possible.
QWidget* createEditor(QWidget* x1, const QStyleOptionViewItem& x2,
const QModelIndex& x3) const {
void* fun = LObjects::overrideFun(unique, 45);
if(fun) {
const void* args[] = { &x1, &x2, &x3 };
return (QWidget*)qVariantValue<void*>(callOverrideFun(fun, 45,
args));
}
return QAbstractItemDelegate::createEditor(x1, x2, x3);
}
So how does one call "AbstractItemDelegate::createEditor" when that
function has been overridden? Returning nil doesn't do the trick.
Invoking the method inside the override causes infinite recursion.
Have I missed something?
Thanks,
Daniel