[PyQt] Re-implemented function doesn't get called from internal
Qt methods
Phil Thompson
phil at riverbankcomputing.com
Wed Nov 25 17:09:24 GMT 2009
On Wed, 25 Nov 2009 15:15:37 +0000, Jugdish <jugdizh at gmail.com> wrote:
> I have written my own class derived from QTabBar with a re-implementation
> of
> the QTabBar::initStyleOption() method, but for some reason it never gets
> executed.
>
> Here is my code:
>
> ########################################
> from PyQt4 import QtGui
>
> class MyTabBar(QtGui.QTabBar):
>
> def initStyleOption(self, option, tabIndex):
> print "inside initStyleOption"
> QtGui.QTabBar.initStyleOption(self, option, tabIndex)
> ########################################
>
> Looking at the Qt source code for QTabBar (qtabbar.cpp), I see that
> initStyleOption() is called inside the paintEvent() method, so I should
be
> seeing my print statement on every paint event.
>
> Any idea what I'm doing wrong?
The C++ method isn't virtual so you can't reimplement it.
Phil
More information about the PyQt
mailing list