Results 1 to 6 of 6

Thread: Problem to declare a stl map - Q_DECLARE_METATYPE

  1. #1
    Join Date
    Oct 2008
    Posts
    29
    Qt products
    Qt4
    Platforms
    Windows

    Default Problem to declare a stl map - Q_DECLARE_METATYPE

    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.

  2. #2
    Join Date
    Feb 2006
    Location
    Oslo, Norway
    Posts
    6,264
    Thanks
    36
    Thanked 1,519 Times in 1,389 Posts
    Qt products
    Qt4
    Platforms
    MacOS X Unix/X11 Windows Symbian S60 Maemo/MeeGo

    Default Re: Problem to declare a stl map - Q_DECLARE_METATYPE

    Try using a typedef.
    J-P Nurmi

  3. #3
    Join Date
    Oct 2008
    Posts
    29
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem to declare a stl map - Q_DECLARE_METATYPE

    I´ve tried it already but it doesn´t work

  4. #4
    Join Date
    Dec 2006
    Posts
    849
    Thanks
    6
    Thanked 163 Times in 151 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11

    Default Re: Problem to declare a stl map - Q_DECLARE_METATYPE

    show us the code you tried

  5. #5
    Join Date
    Oct 2008
    Posts
    29
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem to declare a stl map - Q_DECLARE_METATYPE

    Hi

    The first code:
    Qt Code:
    1. Q_DECLARE_METATYPE(QMap<QString, QString>);
    To copy to clipboard, switch view to plain text mode 

    The code using typedef:
    Qt Code:
    1. typedef QMap<QString, QString> myQMap;
    2. Q_DECLARE_METATYPE(myQMap);
    To copy to clipboard, switch view to plain text mode 

  6. #6
    Join Date
    Oct 2008
    Posts
    29
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: Problem to declare a stl map - Q_DECLARE_METATYPE

    Hi
    The problem is solved. I needed to include <QMetaType> to use typedef.

    Regards.

Similar Threads

  1. deployment problem: msvc++ 2008 Express, Qt 4.4.3
    By vonCZ in forum Qt Programming
    Replies: 7
    Last Post: 10th November 2008, 14:38
  2. Weird problem: multithread QT app kills my linux
    By Ishark in forum Qt Programming
    Replies: 2
    Last Post: 8th August 2008, 09:12
  3. Steps in solving a programming problem?
    By triperzonak in forum General Programming
    Replies: 8
    Last Post: 5th August 2008, 08:47
  4. declare array in a class
    By mickey in forum General Programming
    Replies: 5
    Last Post: 17th April 2006, 20:25
  5. Replies: 16
    Last Post: 7th March 2006, 15:57

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.