How to use a specialization of an C++ interface?



  • Very straight forward case, I register like:

    qmlRegisterUncreatableType<InputDeviceConfiguratorGate>(
        "InputDeviceConfiguratorGate", 1, 0, "InputDeviceConfiguratorGate", "Not creatable in Qml." );
    
    qmlRegisterUncreatableType<JoystickDeviceConfigurator>(
        "JoystickDeviceConfigurator", 1, 0, "JoystickDeviceConfigurator", "Not creatable in Qml." );
    

    JoystickDeviceConfigurator is derived publicly from InputDeviceConfiguratorGate.

    At runtime I get the following error:

    QMetaType::registerTypedef: -- Type name 'InputDeviceConfiguratorGate*' previously registered as typedef of 'InputDeviceConfiguratorGate*' [1049], now registering as typedef of 'JoystickDeviceConfigurator*' [1051].
    

    I actually would like to have InputDeviceConfiguratorGate registered as interface. The question was asked
    here.



  • @c64zottel Ok, I figured it out. My mistake is a missing Q_OBJECT declaration in the JoystickDeviceConfigurator:

    class JoystickDeviceConfigurator : public InputDeviceConfiguratorGate
    {
        Q_OBJECT
    public:
    

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.