<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=us-ascii">
<META content="MSHTML 6.00.2900.2180" name=GENERATOR></HEAD>
<BODY>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=671415805-06062008>I think QAction is the way to go:</SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff size=2><SPAN
class=671415805-06062008>something like this works for
me:<BR></SPAN></FONT></DIV>
<DIV dir=ltr align=left><FONT face=Arial color=#0000ff
size=2> delrecords =
QtGui.QAction(self)<SPAN class=671415805-06062008> # create
action</SPAN><BR>
delrecords.setShortcut(QtCore.Qt.Key_Delete)<SPAN class=671415805-06062008> #
set shortcut key for that
action</SPAN><BR> <SPAN
class=671415805-06062008><</SPAN><SPAN
class=671415805-06062008>YOUR_WIDGET_HERE></SPAN>.addAction(self.delrecords)<SPAN
class=671415805-06062008> # assign action to
widget</SPAN><BR>
self.connect(self.delrecords, QtCore.SIGNAL("triggered()"), deleteRecords)<SPAN
class=671415805-06062008> # connect event <Delete key> is pressed in
YOUR_WIDGET.</SPAN><BR></FONT></DIV>
<DIV><SPAN class=671415805-06062008><FONT face=Arial color=#0000ff
size=2> </FONT></SPAN></DIV><!-- Converted from text/plain format -->
<P><FONT size=2>---<BR>igor@tyumbit.ru<BR></FONT></P>
<DIV> </DIV><BR>
<DIV class=OutlookMessageHeader lang=ru dir=ltr align=left>
<HR tabIndex=-1>
<FONT face=Tahoma size=2><B>From:</B> pyqt-bounces@riverbankcomputing.com
[mailto:pyqt-bounces@riverbankcomputing.com] <B>On Behalf Of
</B>IloChab<BR><B>Sent:</B> Friday, June 06, 2008 12:02 AM<BR><B>To:</B>
PyQt@riverbankcomputing.com<BR><B>Subject:</B> [PyQt] How to get an event after
an Enter key is pressed?<BR></FONT><BR></DIV>
<DIV></DIV>I wrote an application where I display sql data on a
QTableView+QSqlQueryModel read only table.<BR><BR>The current version allows you
to select via mouse a record on that table and then add it to an other one,
pressing an add-button.<BR><BR>I'd like to give an alternate way to do this:
after record line is selected on the table I'd like to be called on the pression
of enter's key and react to it just like if the add button was
pressed.<BR><BR>If is possible to obtain this behaviour I'd like to trap an
other button too:<BR>I'd like to be called when delete's key is pressed while
the record line is selected.<BR><BR>Thanks in advance for your
help.<BR>Ciao<BR>Licia<BR><BR></BODY></HTML>