Boost.Python and Qt inheritance

2019-06-10 09:13发布

问题:

I'm want to wrap my C++ code wrote with Qt framework into python with boost.python. But I really can't understand one issue : when I wrapping class, I should also wrap it's base class. So should I wrap QObject, for example, if class which I need to wrap inherits from it? e.g. :

class TRIKCONTROL_EXPORT BatteryInterface : public QObject, public DeviceInterface
{
    Q_OBJECT

public slots:
    /// Returns current battery voltage in volts.
    virtual float readVoltage() = 0;

    /// Returns current raw reading of battery.
    virtual float readRawDataVoltage() = 0;
};

UPD 1 : Now I'm pretty sure that I don't need to wrap c++ QObject, but I don't know, how to tell my wrapped class to inherit from PyQt QObject. Any ideas?