I need to iterate over QMultiHash and check the list of values corresponding to each key. I need to use a mutable iterator so that I can remove items from the hash if they meet certain criteria. The documentation does not explain how to access all the values, only the first. In addition, the API offers only the value() method. How to get all values for a specific key?
This is what I am trying to do:
QMutableHashIterator<Key, Value*> iter( _myMultiHash ); while( iter.hasNext() ) { QList<Value*> list = iter.values(); // there is no values() method, only value() foreach( Value *val, list ) { // call iter.remove() if one of the values meets the criteria } }
source share