[Qt-interest] Fwd: A Qt-dbus question
Jeroen De Wachter
Jeroen.DeWachter at elis.ugent.be
Fri Sep 3 13:20:47 CEST 2010
Hello,
On Fri, 2010-09-03 at 17:59 +0800, 振华张 wrote:
> Hi Jeroen,
>
> 2010/9/3 Jeroen De Wachter <Jeroen.DeWachter at elis.ugent.be>:
> > I overhauled your code to make it work...
> > I've had to change quite a bit though, so you might not recognize it :-s
>
> Thanks very much for your help! It's really helpful to resolve the
> problem in such a short time.
Sure, no problem
> > I replaced the QArrayOfData struct with a typedef, so the default
> > streaming operators handle the QList<MyData> (you will see that there
> > are no extra streaming operators for QArrayOfData)
>
> QArrayOfData actually is a bad idea. Looks like we could simply use:
>
> struct MyData { ...};
> Q_DECLARE_METATYPE(MyData)
> Q_DECLARE_METATYPE(QList<MyData>)
Actually, that will cause trouble when you put it in the XML description
of your service... the XML parser won't be able to deal with the < and >
characters in the data (I think I mentioned this before?) And I don't
think changing them to < and > worked for me.
I'm also not sure if the Q_DECLARE_METATYPE macro is able to deal with
templates... I think I ran into trouble there too. Or maybe the actual
type registration didn't work, I don't recall precisely. I do remember
there were valid reasons to use the typedef though...
Kind regards,
Jeroen
More information about the Qt-interest-old
mailing list