Bonjour, je m'intéresse fortement à QT et je commence par les tutoriels du site officiel.

J'ai fait le tutoriel AdressBook sans soucis mais un comportement étrange est apparu.

l'ojet QMap n'arrive pas à retourner le dernier élément de la map.

pouvez vous m'éclairer?

exemple:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
 
QMap<QString, QString> contacts;
contacts.insert("tutu", "123");
contacts.insert("toto", "456");
 
setWindowTitle(contacts.end().key());    // PLANTAGE
 
QMap<QString, QString>::iterator i = contacts.find("toto");
if (i == contacts.end()) 
  i = contacts.begin();  //Ne passe jamais par ici
l'adresse de la partie du tutoriel concerné:
adresse book partie 3


ceci a attiré mon attention parce que dans le tutoriel (en fin de troisième partie) il est noté ceci
Similarly, for the previous() function, we obtain an iterator for contacts and then:

* If the iterator is at the end of contacts, we clear the display and return.
or jamais les éléments affichés sont effacés dans le slot previous en fin de liste.