Page 1 of 2 12 LastLast
Results 1 to 20 of 22

Thread: How to install Qjson in mac

  1. #1
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default How to install Qjson in mac

    Hi,

    I am a very new to this one. How to install QJson in mac

    Thanks in advance

  2. #2
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install Qjson in mac

    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  3. #3
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to install Qjson in mac

    Thanks. But it shows the error : "You are building a 64-bit application, but using a 32-bit version of Qt. Check your build configuration." please help me.

  4. #4
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install Qjson in mac

    Use a 64-bit version of Qt or build the application using a 32-bit compiler.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  5. The following user says thank you to wysota for this useful post:

    Girija (14th September 2010)

  6. #5
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to install Qjson in mac

    Hi,

    thank you very much.. My json output look like [{"id":2,"name":"AAA"},{"id":1,"name":"BBB"}]. I want to parse this using Qjson in mac. I am trying to parsing but I could not get any outputs . please help me.

    Thanks in advance

  7. #6
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install Qjson in mac

    So what did you already try?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  8. #7
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to install Qjson in mac

    I am using the following code,
    QJson::Parser parser;
    bool ok;
    QVariantMap result = parser.parse (cityReply->readAll(), &ok).toMap();
    if (!ok) {
    qFatal("An error occurred during parsing");
    exit (1);
    }
    qDebug() << "Name :" << result.value("name").toString();

    }
    the output is : Name : ""

    Note : if I displays cityReply->readAll() in messagebox then I can view the webservice result (json String).

  9. #8
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to install Qjson in mac

    Your map is empty.

    About the toMap() function:
    Returns the variant as a QMap<QString, QVariant> if the variant has type() Map; otherwise returns an empty map.
    Check with canConvert.

  10. #9
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to install Qjson in mac

    Thanks. I am trying this one.

    Could you explain little bit more?

  11. #10
    Join Date
    Jan 2006
    Location
    Belgium
    Posts
    1,938
    Thanked 268 Times in 268 Posts
    Qt products
    Qt4
    Platforms
    Unix/X11 Windows
    Wiki edits
    20

    Default Re: How to install Qjson in mac

    I browsed the QJson website a little.
    You should be able to convert the variant to a map, but it's always a good idea to check first.

    Qt Code:
    1. QVariant result = parser.parse (cityReply->readAll(), &ok);
    2.  
    3. if (result.canConvert<QMap>()) {
    4. QVariantMap resultMap = result.toMap();
    5. } else {
    6. qDebug() << "Can not convert to a map.";
    7. }
    To copy to clipboard, switch view to plain text mode 

  12. #11
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to install Qjson in mac

    Thanks . But I am getting the error "error: no matching function for call to 'QVariant::canConvert()'.
    Is it possible to convert the QByteArray to QMap?

  13. #12
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install Qjson in mac

    How are you calling canConvert?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  14. #13
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to install Qjson in mac

    I am using the following code,

    QVariant result = parser.parse (cityReply->readAll(), &ok);

    if (result.canConvert<QMap>()) {
    QVariantMap resultMap = result.toMap();
    } else {
    qDebug() << "Can not convert to a map.";
    }

    Please point out any mistakes

  15. #14
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install Qjson in mac

    What compiler are you using? MSVC6? Unlikely (it seems you are on a Mac), so it should be working. Is this your exact code?
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  16. #15
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to install Qjson in mac

    yes .. This is my exact code.

  17. #16
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install Qjson in mac

    It should be:
    Qt Code:
    1. result.canConvert<QVariantMap>()
    To copy to clipboard, switch view to plain text mode 
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  18. #17
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to install Qjson in mac

    Hi,

    I could not convert the Json result into QVarientMap.
    The canConvert function returns false value.

    is there any other option?

  19. #18
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install Qjson in mac

    Maybe the library simply can't parse your string.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


  20. #19
    Join Date
    Sep 2010
    Location
    Chennai
    Posts
    37
    Thanks
    8
    Qt products
    Qt4
    Platforms
    MacOS X

    Default Re: How to install Qjson in mac

    could you please tell me other options for solve this one?

    Thanks in advance.

  21. #20
    Join Date
    Jan 2006
    Location
    Warsaw, Poland
    Posts
    33,359
    Thanks
    3
    Thanked 5,015 Times in 4,792 Posts
    Qt products
    Qt3 Qt4 Qt5 Qt/Embedded
    Platforms
    Unix/X11 Windows Android Maemo/MeeGo
    Wiki edits
    10

    Default Re: How to install Qjson in mac

    Parse it yourself.
    Your biological and technological distinctiveness will be added to our own. Resistance is futile.

    Please ask Qt related questions on the forum and not using private messages or visitor messages.


Similar Threads

  1. QJson Windows compile problem
    By skepticalgeek in forum Qt Programming
    Replies: 2
    Last Post: 9th August 2010, 01:15
  2. Replies: 4
    Last Post: 18th April 2010, 00:37
  3. How to add a plugin? (QJson)
    By Thomas Wrobel in forum Newbie
    Replies: 5
    Last Post: 3rd December 2009, 21:46
  4. How install fonts with make install
    By jiveaxe in forum Qt Programming
    Replies: 1
    Last Post: 2nd January 2008, 19:38
  5. "make install" doesn't install binary
    By jiveaxe in forum Newbie
    Replies: 2
    Last Post: 2nd January 2008, 12:00

Tags for this Thread

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.