Solved Give qdbusxml2cpp some options within QtCreator
I am using qdbusxml2cpp to generate the adaptor and the interface class for dbus.
I saw there is option "-c" give the name of the class.
How can I add this option to qdbusxml2cpp in QtCreator?
How do you call
I am not explicitly calling qdbusxml2cpp.
I think it is automatically used because of these two lines in the project file:
DBUS_ADAPTORS += org.example.xml DBUS_INTERFACES += org.example.xml
Now I am wondering if it is possible to give some options to this?
I want to give the class names with the option "-c".
Looks like the comment section in QTBUG-45434 has some hints on this.
There are two ways of passing flags to qdbusxml2cpp. One way is to set it for all interfaces and for all adaptors:
QDBUSXML2CPP_INTERFACE_HEADER_FLAGS QDBUSXML2CPP_INTERFACE_SOURCE_FLAGS QDBUSXML2CPP_ADAPTOR_HEADER_FLAGS QDBUSXML2CPP_ADAPTOR_SOURCE_FLAGS
In case you want to pass different flags for different source XML, you'll want the following instead:
DBUS_ADAPTORS += chat chat.files = org.example.chat.xml chat.header_flags = -lFoo chat.source_flags = -lFoo
that was exactly the soultion.
DBUS_ADAPTORS += org.example.xml
DBUS_ADAPTORS += dbusAdaptor dbusAdaptor.files = org.example.xml dbusAdaptor.header_flags = -cdbus_adaptor dbusAdaptor.source_flags = -cdbus_adaptor
in the project file.
So the class name dbus_adaptor is used for the D-Bus adaptor.