PDA

View Full Version : Problem to declare a stl map - Q_DECLARE_METATYPE



Althor
5th December 2008, 09:53
Hi,
I have a problem with Q_DECLARE_METATYPE

I´m trying to declare the type map<string,string> to use it at signals and slots, but because of the type contains a comma I get the following error:

macro "Q_DECLARE_METATYPE" passed 2 arguments, but takes just 1

How could I declare that type?

Thanks in advance.
Regards.

jpn
5th December 2008, 13:35
Try using a typedef.

Althor
9th December 2008, 06:41
I´ve tried it already but it doesn´t work :(

caduel
9th December 2008, 08:22
show us the code you tried

Althor
9th December 2008, 09:04
Hi

The first code:

Q_DECLARE_METATYPE(QMap<QString, QString>);

The code using typedef:

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

Althor
9th December 2008, 09:41
Hi
The problem is solved. I needed to include <QMetaType> to use typedef.

Regards.