Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. QML and Qt Quick
  4. How to use a specialization of an C++ interface?
QtWS25 Last Chance

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

Scheduled Pinned Locked Moved Solved QML and Qt Quick
qmlregisterinteinterface
2 Posts 1 Posters 1.0k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • C Offline
    C Offline
    c64zottel
    wrote on 27 May 2017, 13:32 last edited by
    #1

    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.

    C 1 Reply Last reply 28 May 2017, 19:43
    0
    • C c64zottel
      27 May 2017, 13:32

      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.

      C Offline
      C Offline
      c64zottel
      wrote on 28 May 2017, 19:43 last edited by
      #2

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

      class JoystickDeviceConfigurator : public InputDeviceConfiguratorGate
      {
          Q_OBJECT
      public:
      
      1 Reply Last reply
      0

      1/2

      27 May 2017, 13:32

      • Login

      • Login or register to search.
      1 out of 2
      • First post
        1/2
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved