Hello,

I would like to know how to modify a key associated with a value.

QHash<QString,Packet*> hash; Packet being my class object.

I have initially created the keys with empty objects. The hash consists of 5 items but i would like to modify the values for a particular key. I have tried the below but it sets the value for all keys.

Qt Code:
  1. if(hash.contains(s_ip))
  2. {
  3. QList<Packet*> pkt = hash.values();
  4. QListIterator<Packet*> i(pkt);
  5. while (i.hasNext()){
  6. Packet *temp = i.next();
  7.  
  8. temp->setLength(len);
To copy to clipboard, switch view to plain text mode