*** GMX Spamverdacht *** [PyQt] Getting mouse and key event with a qtablewidget

Andreas Pakulat apaku at gmx.de
Thu Mar 15 17:10:21 GMT 2007

On 15.03.07 16:51:13, duncan duncan wrote:
> I'd like to be able to process the mouse and key pressed event with a
> qtablewidget
> The goal is to have a table in which the number of rows and columns are
> dinamically
> created when certain keys are pressed and that had a context menu to delete
> the
> row/column.
> An example can be: if I press the tab key on the last column, a column is
> added to the table or if I press the
> arrow down on the last row, a new row is added.
> Any hints ?

For the context menu there exists the contextMenuEvent() member in
QWidget, so you can subclass QTableWidget and re-implement that method.

For the key-features you can override the keyPressEvent member function
and properly react on Tab and arrow key if you're in the "right"


Don't look back, the lemmings are gaining on you.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20070315/490641c0/attachment.bin

More information about the PyQt mailing list