Subclassing a Qt Class and Still using Base Class Methods
Dynamic Python binding for Qt Applications
Brought to you by:
florianlink,
marcusbarann
Hi
I'm using PythonQt for creating customized objects on a frame.
what am I doing is that I'm subclassing QFrame (for example) and adding some features and methods for my own class (MyFrame) . then I wrote a wrapper class like what examples of PythonQt said. the problem comes out when I create an instance of MyFrame (myFrame) it'll not recognizing MyFrame as a subclass of QFrame and also don't show it's base class methods for using. it'll just shows my own methods in the wrapper class and i'm not having access to other methods in the base class.
codes below shows my tutorial:
<<------- PROBLEM: where QFrame methods are not available as sensor's base class (just setValue is available not for example show() , hide(), setSizePolicy() and etc
can you help me with this issue?
it'll be very helpful :)
Last edit: Mortie 2019-03-30
You probably need to initialize PythonQtAll, because it contains the wrappers for QFrame. without generated wrappers, PythonQt can only provide the slots,signals and properties, but not methods that the moc does not handle. Calling PythonQtAll::init() before registering your class should do the trick. You could also pass in the name of the parent clas when registerings, but that is not really needed on Qobjects, I think.