[Development] How to deal with C++ Interfaces in Qml?
c64zottel .
c64zottel at gmail.com
Sun May 28 08:41:33 CEST 2017
Hello,
I am trying to figure out how to pass objects derived from a pure virtual
class and encountered several issues (I guess):
There are 2 classes derived from InputDeviceConfiguratorGate:
JoystickDeviceConfigurator and KeyboardDeviceConfigurator.
If I try to register them like:
qmlRegisterUncreatableType<JoystickDeviceConfigurator>(
"JoystickDeviceConfigurator", 1, 0, "JoystickDeviceConfigurator", "Not
creatable in Qml." );
qmlRegisterUncreatableType<KeyboardDeviceConfigurator>(
"KeyboardDeviceConfigurator", 1, 0, "KeyboardDeviceConfigurator", "Not
creatable in Qml." );
Then Qml throws:
QMetaType::registerTypedef: -- Type name 'InputDeviceConfiguratorGate*'
previously registered as typedef of 'JoystickDeviceConfigurator*' [1049],
now registering as typedef of 'KeyboardDeviceConfigurator*' [1052].
If I to use
qmlRegisterInterface<InputDeviceConfiguratorGate>(
"InputDeviceConfiguratorGate" );
Then I can't use the actual interface in Qml. (I can? How?)
I already asked on the qt forum:
https://forum.qt.io/topic/79589/how-to-use-a-virtual-interface-in-qml-with-qmlregisterinterface
https://forum.qt.io/topic/79691/how-to-use-a-specialization-of-an-c-interface
to find out someone else opened the topic 2 years ago:
https://forum.qt.io/topic/54387/how-do-you-use-c-interfaces-pure-virtual-class-in-qml
Thanks for your time.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20170528/419ef660/attachment.html>
More information about the Development
mailing list