Results 1 to 2 of 2

Thread: Problem with QMap

  1. #1
    Join Date
    Jul 2007
    Posts
    8
    Qt products
    Qt3 Qt4 Qt/Embedded
    Platforms
    Unix/X11

    Default Problem with QMap

    please teach me what wrong with the following piece of code,

    Qt Code:
    1. QMap<QString, QString> xMap;
    2.  
    3. for( int i = 0; i <100; i++)
    4. {
    5. QString cKey;
    6. cKey = cKey.setNum(i);
    7. xMap[cKey] = cKey;
    8. }
    To copy to clipboard, switch view to plain text mode 
    The problem point to 'xMap[cKey] = cKey' line and say
    error: no matching function for call to ‘QString::insert(QString&, QString&)
    thank for reply...
    comlink21..
    Last edited by jpn; 10th December 2007 at 07:32. Reason: missing [code] tags

  2. #2
    Join Date
    Oct 2007
    Location
    Munich, Bavaria
    Posts
    144
    Thanks
    1
    Thanked 19 Times in 19 Posts
    Qt products
    Qt3 Qt4
    Platforms
    Unix/X11 Windows

    Default Re: Problem with QMap

    Hi,

    I just compiled your code. I have no compiler errors on Linux & Qt 4.3.2.
    Which platform? Which compiler? Which Qt-version? - These information is always necessary! ;-)

    Good Luck,

    Tom

    PS: You can skip the assignment cKey = cKey.setNum(i). cKey.setNum(i) is enough.
    Read the api docs carefully.

Similar Threads

  1. QMap model data
    By gyre in forum Newbie
    Replies: 3
    Last Post: 9th December 2007, 22:19
  2. QMap Problem with arguments.
    By ankurjain in forum Qt Programming
    Replies: 1
    Last Post: 24th May 2006, 12:12
  3. QMap destructor bug
    By Ruud in forum Qt Programming
    Replies: 6
    Last Post: 8th April 2006, 09:08
  4. Problem with bitBlt
    By yellowmat in forum Newbie
    Replies: 1
    Last Post: 5th April 2006, 14:08
  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.