#include
<QApplication>
#include <QtCore/QtCore>
#include <QMap>
enum UnitsType{SPS,DPS,SPC,DPC,INS,MV,CMV,SPG,ING,ASG,STG};
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QMap<QString,int> itemTypeMap;
itemTypeMap["SPS"] = SPS;
itemTypeMap["DPS"] = DPS;
itemTypeMap["SPC"] = SPC;
itemTypeMap["DPC"] = DPC;
itemTypeMap["INS"] = INS;
itemTypeMap["MV"] = MV;
itemTypeMap["CMV"] = CMV;
itemTypeMap["SPG"] = SPG;
itemTypeMap["ING"] = ING;
itemTypeMap["ASG"] = ASG;
itemTypeMap["STG"] = STG;
qDebug()<<itemTypeMap.value("SPS"); // 输出:0
qDebug()<<itemTypeMap.value("aadfa"); //输出:0
return app.exec();
}