[PyQt] QTabWidget subclassing woes

Hans-Peter Jansen hpj at urpla.net
Sat Jul 18 11:18:37 BST 2009


Hi,

I tried to subclass QTabWidget in order to do some processing before a tab 
is displayed or left. The problem is, that my setCurrentIndex methods are 
not called, if switching tabs via keyboard (cursor left/right on linux).

Interestingly, my keyPressEvent handlers are called. Out of desperation, I 
also intercepted QTabBar, but beside key presses, the expected calls to 
setCurrentIndex are missing. I've added some shortcuts (Alt+Left/Right) to 
switch tabs programmatically, but I would like to catch all set* calls.

Do I do something stupid, or do I need to handle the key presses myself 
(which would make the whole thing less robust and less portable)?

TIA, Pete
-------------- next part --------------
A non-text attachment was scrubbed...
Name: tabwidget.py
Type: application/x-python
Size: 2795 bytes
Desc: not available
Url : http://www.riverbankcomputing.com/pipermail/pyqt/attachments/20090718/2747ba6d/tabwidget-0001.bin


More information about the PyQt mailing list