以下成员源于类 QMap are part of the Qt compatibility layer. We advise against using them in new code.
| void | erase (const Key & key ) |
| iterator | insert (const Key & key , const T & value , bool overwrite ) |
| iterator | remove (iterator it ) |
| iterator | replace (const Key & key , const T & value ) |
Use remove( key ) 代替。
Use the two-argument insert () overload instead. If you don't want to overwrite, call contains () 事先。
例如,若有代码像
QMap<QString, int> map;
...
map.insert("delay", 30000, false);
可以把它重写成
QMap<QString, int> map; ... if (!map.contains("delay")) map.insert("delay", 30000);
Use erase( it ) 代替。