创建全局变量.h文件
globalvariable.h
1 #ifndef GLOBALVARIABLE_H
2 #define GLOBALVARIABLE_H
3 #include <QImage>
4
5 //全局变量
6 class GlobalVariable
7 {
8 public:
9 //图像变量
10 static QImage GV_QImage;
11 };
main.cpp
1 #include "XXXXX.h"
2 #include <QApplication>
3
4 int main(int argc, char *argv[])
5 {
6 QApplication a(argc, argv);
7 JaiCamera w;
8 w.show();
9
10 return a.exec();
11 }
12
13 //全局变量初始化
14 QImage GlobalVariable::GV_QImage;
需要用到的.cpp程序里
GlobalVariable::GV_QImage = XXXXXX;