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:<br><br>library(qtbase)<br>e <- Qt$QLineEdit()<br>e$mousePressEvent <- function(e) print("called")<br>
<br>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<br>
<br>qsetClass("gwQLineEdit", Qt$QLineEdit, function() super(parent))<br>qsetMethod("mousePressEvent", gwQLineEdit, function(e) print("do something depending on value of this...."))<br><br>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?<br clear="all">
<br>Thanks for any help,<br><br>John<br>-- <br>John Verzani<br>Chair, Department of Mathematics<br>College of Staten Island, CUNY<br><a href="mailto:verzani@math.csi.cuny.edu">verzani@math.csi.cuny.edu</a><br>