QMap

 

 

 

  QMap<QString, int> map;

 

map["one"] = 1;
map["three"] = 3;
map["seven"] = 7;

 

map.insert("twelve", 12);

 

int num1 = map["thirteen"];
int num2 = map.value("thirteen");

 

int timeout = 30;
if (map.contains("TIMEOUT"))
      timeout = map.value("TIMEOUT");

 

  QMapIterator<QString, int> i(map);
  while (i.hasNext()) {
      i.next();
      cout << i.key() << ": " << i.value() << endl;
  }

 

 

 

 

 

 

 

 

 

 

 

 

####################################

posted @ 2024-10-02 23:48  西北逍遥  阅读(7)  评论(0编辑  收藏  举报