const Key QMap::key ( const T & value ) const

返回对应值value的第一个key
如果map不包含项目,函数返回一个缺省的构建的key
函数是慢的(线性时间),因为QMap的内部数据结构是最佳的为快速查找b通过key,而不是通过value

const Key QMap::key ( const T & value, const Key & defaultKey ) const

QList<Key> QMap::keys () const

QList<Key> QMap::keys ( const T & value ) const

iterator QMap::lowerBound ( const Key & key )

返回一个迭代器指向key对应的第一个项目。如果map不包含key对应项目,函数返回一个迭代器到一个最近的较大的key对应的项目。
QMap<int, QString> map;
 map.insert(1, "one");
 map.insert(5, "five");
 map.insert(10, "ten");
 
 map.lowerBound(0);      // returns iterator to (1, "one")
 map.lowerBound(1);      // returns iterator to (1, "one")
 map.lowerBound(2);      // returns iterator to (5, "five")
 map.lowerBound(10);     // returns iterator to (10, "ten")
 map.lowerBound(999);    // returns end()
如果map包含多重项目,这个函数返回一个迭代器,指向最近的值。另一个值是可进入的通过增加迭代器。例如,这是一些代码,迭代相同key的所有项目:
QMap<QString, int> map;
 ...
 QMap<QString, int>::const_iterator i = map.lowerBound("HDR");
 QMap<QString, int>::const_iterator upperBound = map.upperBound("HDR");
 while (i != upperBound) {
     cout << i.value() << endl;
     ++i;
 }

const_iterator QMap::lowerBound ( const Key & key ) const

int QMap::remove ( const Key & key )

int QMap::size () const

T QMap::take ( const Key & key )

移除key对应的项目,返回对应的值。如果项目不存在于map,函数简单的返回一个缺省构造的值。如果一个key对应多个项目,只是最近的插入的一个被移除并返回。
如果你不使用返回值,remove()是更有效率的。

std::map<Key, T> QMap::toStdMap () const

然会一个stl map等同于这个QMap

QList<Key> QMap::uniqueKeys () const

返回一个清单,包含所有的key在升序。在map发生多次的keys在返回清单中只发生一次。

QMap<Key, T> & QMap::unite ( const QMap<Key, T> & other )

插入其他map中所有的项目到这个map。如果一个key是普遍的maps,结果map将包含key多次。

iterator QMap::upperBound ( const Key & key )

返回一个迭代器指向立即跟着最后一个项目的项目。如果map不包含key对应的项目,函数返回一个迭代器到最近一个较大的key的项目。
QMap<int, QString> map;
 map.insert(1, "one");
 map.insert(5, "five");
 map.insert(10, "ten");
 
 map.upperBound(0);      // returns iterator to (1, "one")
 map.upperBound(1);      // returns iterator to (5, "five")
 map.upperBound(2);      // returns iterator to (5, "five")
 map.upperBound(10);     // returns end()
 map.upperBound(999);    // returns end()

const_iterator QMap::upperBound ( const Key & key ) const

const T QMap::value ( const Key & key ) const

const T QMap::value ( const Key & key, const T & defaultValue ) const

QList<T> QMap::values () const

QList<T> QMap::values ( const Key & key ) const

bool QMap::operator!= ( const QMap<Key, T> & other ) const

QMap<Key, T> & QMap::operator= ( const QMap<Key, T> & other )

bool QMap::operator== ( const QMap<Key, T> & other ) const

T & QMap::operator[] ( const Key & key )

const T QMap::operator[] ( const Key & key ) const

相关非成员:

QDataStream & operator<< ( QDataStream & out, const QMap<Key, T> & map )

map到流out中。

QDataStream & operator>> ( QDataStream & in, QMap<Key, T> & map )

读一个map从流inmap