[RQt-devel] virtual functions

John Verzani verzani at math.csi.cuny.edu
Sat Apr 17 01:48:37 CEST 2010


I'm trying to create a virtual function to handle an event. After spending
time with the proto package I was hoping that something like this would
work:

library(qtbase)
e <- Qt$QLineEdit()
e$mousePressEvent <- function(e) print("called")

However, it doesn't. I know how to work around this by extending the
QLineEdit class, defining a method mousePressEvent in that class which can
consider the state of the instance in the call.  Along the lines of

qsetClass("gwQLineEdit", Qt$QLineEdit, function() super(parent))
qsetMethod("mousePressEvent", gwQLineEdit, function(e) print("do something
depending on value of this...."))

This just seems like I am doing it wrong. (For one thing it calls this
method even if no event handler for the instance is defined.) Is there a
better way?

Thanks for any help,

John
-- 
John Verzani
Chair, Department of Mathematics
College of Staten Island, CUNY
verzani at math.csi.cuny.edu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.r-forge.r-project.org/pipermail/qtinterfaces-devel/attachments/20100416/d3f27567/attachment.htm 


More information about the Qtinterfaces-devel mailing list