How and why Qt functions can be overridden

Maurizio Berti maurizio.berti at
Sun Aug 29 19:09:48 BST 2021

Thank you for your reply, but it doesn't really answer my question.

> One thing is that I don't think being public or protected or private is
>> important for overridden methods. They will behave the same way regardless
>> as far as virtualness and being overridden are concerned. The only thing
>> that changes is who can invoke them.
That's exactly my point: I know I can override a protected non virtual
method, but that would only be "just another method" that will only be
called when explicitly called by me: I could even name it in any other
way, and that won't change anything.
The problem is about methods that are invoked by Qt itself, like those I
reported: QItemDelegate.drawBackground or QComboBox.initStyleOption. If
they are implemented, they are never used by Qt, and can only be explicitly
called by python code.

Thank you anyway,
È difficile avere una convinzione precisa quando si parla delle ragioni del
cuore. - "Sostiene Pereira", Antonio Tabucchi
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the PyQt mailing list