Give qdbusxml2cpp some options within QtCreator



  • Hi!

    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?

    Kind regards,
    MHermann



  • Hi @MHermann:

    How do you call qdbusxml2cpp from Creator?



  • Hi @aha_1980,

    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".



  • Hi @MHermann,

    Looks like the comment section in QTBUG-45434 has some hints on this.

    Quoting:

    "
    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
    

    "

    Regards



  • Hi @aha_1980,

    that was exactly the soultion.

    I changed

    DBUS_ADAPTORS += org.example.xml
    

    to

    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.


Log in to reply
 

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