Tuesday, 15 April 2014

python - PyQt subclassing -


The usual way to use Qt widgets from Python is considered to be a subclass.

The Qt widget class is a great many methods, so essentially I'm going to end up adding a method for the subclass, as the Python with the same name inherited from the Qt widget In, all the methods are virtual, so I'm worried about it, that some QT code might possibly call my method instead of Qt one - in the worst case, break the case of some edge. Simply do not take the test.

On the other hand, all PyQt methods may only be wrappers for the C ++ code, which certainly will not affect anything in terms of Python subclassing.

> Anyone know how that is the case

if underlaying C ++ If the methods are virtual, your Python methods will be called to call them C ++ code at any time to override them. If they are just regular methods, then any C ++ code will call the original C ++ methods by default (Python code will call Python methods though, because it looks at the Python object and all the methods are "virtual").


No comments:

Post a Comment