[PyQt] QTabWidget subclassing woes

Andreas Pakulat apaku at gmx.de
Sat Jul 18 12:04:59 BST 2009


On 18.07.09 12:18:37, Hans-Peter Jansen wrote:
> 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).

Thats because the C++ setCurrentIndex method is not virtual and hence
cannot be overriden so easily.

Your only options are handling all events yourself (also check wether
QTabWidget has any event filters set) or do your processing based on the
currentChanged() signal instead (i.e. post-processing). 

Andreas

-- 
Your analyst has you mixed up with another patient.  Don't believe a
thing he tells you.


More information about the PyQt mailing list