Thanks David!! I've forgot that method...<br>
That worked very good.<br>
<br>
Cheers.<br><br><div><span class="gmail_quote">2007/10/18, David Boddie <<a href="mailto:dboddie@trolltech.com">dboddie@trolltech.com</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Thu Oct 18 03:22:32 BST 2007, Gustavo A. Díaz wrote:<br><br>> What i want to do this time, is to disable a key event in my app. For<br>> example i want to avoid closing the app by pressing ALT + F4:<br>><br>> def keyPressEvent(self, event):
<br>> if event.key() == QtCore.Qt.Key_F4 and (event.modifiers() &<br>> QtCore.Qt.AltModifier):<br>> # DO Nothing. How?<br>><br>> So, which action or code i should implement in place of "# DO Nothing. How?"
<br><br>If you want to stop key events from being passed on to other widgets, just<br>accept the key event with event.accept().<br><br>If you want to intercept events at a higher level, you'll need to start<br>looking at event filters. The event model is described in detail in a Qt
<br>Quarterly article from 2004:<br><br> <a href="http://doc.trolltech.com/qq/qq11-events.html">http://doc.trolltech.com/qq/qq11-events.html</a><br><br>On the other hand, if you just want to stop the window from being closed by
<br>the window system, you should reimplement closeEvent() in your main window<br>and explicitly ignore the event passed to it:<br><br> def closeEvent(self, event):<br> event.ignore()<br><br>Hope this helps,<br><br>
David<br>--<br>David Boddie<br>Lead Technical Writer, Trolltech ASA<br><br>_______________________________________________<br>PyQt mailing list <a href="mailto:PyQt@riverbankcomputing.com">PyQt@riverbankcomputing.com</a>
<br><a href="http://www.riverbankcomputing.com/mailman/listinfo/pyqt">http://www.riverbankcomputing.com/mailman/listinfo/pyqt</a><br></blockquote></div><br><br clear="all"><br>-- <br>Gustavo A. Díaz<br>GDNet Projects<br><a href="http://www.gdnet.com.ar">
www.gdnet.com.ar</a>