Results 1 to 4 of 4

Thread: strange behavior of QMapIterator

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Join Date
    Jan 2006
    Location
    Graz, Austria
    Posts
    8,416
    Thanks
    37
    Thanked 1,544 Times in 1,494 Posts
    Qt products
    Qt3 Qt4 Qt5
    Platforms
    Unix/X11 Windows

    Default Re: strange behavior of QMapIterator

    If you want an iterator that points to a respective entry instead of between entries, you can use STL-style ones.

    Qt Code:
    1. QCPFinancialDataMap::const_iterator it = map.constBegin();
    2. // it points to first entry
    3.  
    4. ++it;
    5. // it points to second entry
    6.  
    7. --it;
    8. // it points to first entry
    To copy to clipboard, switch view to plain text mode 

    Cheers,
    _

  2. #2
    Join Date
    Nov 2007
    Posts
    55
    Thanks
    1
    Thanked 9 Times in 9 Posts
    Qt products
    Qt4
    Platforms
    Windows

    Default Re: strange behavior of QMapIterator

    thank you to both!

    I was not aware that the the value() points to the item skipped over!
    You are right guessing that I had iterated past 14 , jthomps. Your description matches exactly my situation.

    Using a STL-like iterator is in that case more elegant.
    I used the Java-style iterator because it is defined as typedef in the library (qcustomplot) I am using.

    Alain

Similar Threads

  1. Qt process strange behavior
    By rspock in forum Newbie
    Replies: 5
    Last Post: 15th March 2013, 17:11
  2. Qt Creator Strange behavior of GDB in Creator 1.3
    By rayjc in forum Qt Tools
    Replies: 1
    Last Post: 11th March 2010, 21:42
  3. Strange behavior of QSqlTableModel
    By venomj in forum Qt Programming
    Replies: 0
    Last Post: 13th January 2010, 03:29
  4. Strange resize behavior
    By Lykurg in forum Newbie
    Replies: 3
    Last Post: 9th January 2007, 13:56
  5. scrollbars strange behavior
    By siniy in forum Qt Programming
    Replies: 6
    Last Post: 29th December 2006, 10:27

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
  •  
Qt is a trademark of The Qt Company.