多个文件使用全局变量

目录

1 声明

//A.h
extern QMap<ToolTask, QString> KToolTaskTxt;

2 初始化

全局区域初始化

//A.cpp
QMap<ToolTask, QString> KToolTaskTxt={
    {I_ADD_SCREW,"add screw"},
    {I_ADD_ARROW,"add arrow"},
    {I_ADD_LABEL,"add label"},
    {I_MEASURE_LINE,"measure line"},
    {I_MEASURE_MULTILINE,"measure multiline"},
    {I_MEASURE_ANGLE,"measure angle"},
    {I_MEASURE_SQUARE,"measure square"}
};

3 使用

#include "A.h"
上一篇:Djano编写视图类时报错:AttributeError: type object ‘Measure_Tools‘ has no attribute ‘objects‘


下一篇:ORACLE存储过程创建失败,如何查看其原因