Binding keyPressEvent() to a QTableWidget with QT Script
Hi all,
Can anyone tell me how I can bind the keyPressEvent() (ore something similar) to a QTableWidget so that I check which key was pressed in a cell?
I tried somthing like this:
Code:
...
twTable.keyPressEvent = function(e) {
//Do something
}
...
But it didn't work.
Thanks
Re: Binding keyPressEvent() to a QTableWidget with QT Script
This won't work because keyPressEvent is not a slot so it is not visible from within QtScript. Make a custom function (or even class) that will install an event filter on the widget.
Re: Binding keyPressEvent() to a QTableWidget with QT Script
Thank you for the answer wysota,
But is it possible to show me an examlpe on how to do that? Or is there somewhere some documentation about this?
I also like to note that I can only use QT Script for this project, so I can't start changing the code of the application that runs the script.
Thanks in advance.
Re: Binding keyPressEvent() to a QTableWidget with QT Script
Quote:
Originally Posted by
De_Dood
I also like to note that I can only use QT Script for this project, so I can't start changing the code of the application that runs the script.
This can't be done without extending your scripting environment.