[Interest] QtDBus Compiletime error using QMap<QString,QString>

Philipp Schmidt philschmidt at gmx.net
Wed Jul 25 15:19:06 CEST 2012


Hi,

i have the following DBus Definition:

<?xml version="1.0" ?>
<node name="/filesystem">
    <interface name="org.mtpd">
        <method name="list">
            <!-- path: the path on the device to list -->
            <arg direction="in"  type="s"     name="path" />
            
            <!-- array contents: name/mimetype pairs -->
            <annotation name="org.qtproject.QtDBus.QtTypeName.Out0" 
value="QMap<QString,QString>"/>
            <arg direction="out" type="a{ss}" name="contents" />
        </method>
        
        <method name="info">
            <!-- path: the path on the device to get the info from -->
            <arg direction="in"  type="s"     name="path" />
            
            <arg direction="out" type="s" name="name" />
            <arg direction="out" type="i" name="size" />
            <arg direction="out" type="s" name="mimetype" />
            <arg direction="out" type="s" name="modificationdate" />
        </method>
    </interface>
</node>

This is used to generate code for the dbus service as well as the clients. 
When using it with dbus-c++ all works fine, but QtDBus makes problems. When I 
try to compile the attached testproject (or any other project) i get the 
following error:

/usr/include/QtCore/qmetatype.h:169:80: error: ‘qt_metatype_id’ is not a 
member of ‘QMetaTypeId<QMap<QString, QString> >’

As can be seen in the attached project (The mtpd-interface.h is normally 
generated, i included it for convenience) I do the following in the main 
header file

typedef QMap<QString,QString> StringMap;
Q_DECLARE_METATYPE(StringMap)

and in the Constructor in the cpp I do a

qDBusRegisterMetaType<StringMap>();


So what am I doing wrong?

Kind Regards
Philipp Schmidt

PS: I also put the project tar.gz in my dropbox: 
http://dl.dropbox.com/u/14496907/mtp-dbus-testproject.tar.gz
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120725/d496f23f/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: mtp-dbus-testproject.tar.gz
Type: application/x-compressed-tar
Size: 1879 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20120725/d496f23f/attachment.bin>


More information about the Interest mailing list