I worked with qmlRegisterInterface. My virtual call is InputDeviceConfigurator:
class InputDeviceConfigurator : public QObject { Q_OBJECT public: explicit InputDeviceConfigurator(QObject *parent = 0); Q_INVOKABLE virtual QString deviceId() = 0; }
I will register it as follows:
qmlRegisterInterface<InputDeviceConfigurator>( "InputDeviceConfigurator" );
And then use the inherited JoystickConfigurator class:
class JoystickConfigurator : public InputDeviceConfigurator { public: JoystickConfigurator( JoystickDevice * device );
And how can I use it:
Component.onCompleted: console.log( UserInputManagement.getConfigurator().deviceId() )
UserInputManagement is just a Singleton with:
Q_INVOKABLE InputDeviceConfigurator * getConfigurator();
source share