Qt static keyword global variables

Create global variables .h file

globalvariable.h

. 1  #ifndef GLOBALVARIABLE_H
 2  #define GLOBALVARIABLE_H
 . 3 #include <the QImage>
 . 4  
. 5  // global variables 
. 6  class GlobalVariable
 . 7  {
 . 8  public :
 . 9      // image variable 
10      static    the QImage GV_QImage;
 . 11 };

 

main.cpp

. 1 #include " XXXXX.h " 
2 #include <the QApplication>
 . 3  
. 4  int main ( int argc, char * the argv [])
 . 5  {
 . 6      the QApplication A (argc, the argv);
 . 7      JaiCamera W;
 . 8      w.show ();
 . 9  
10      return a.exec ();
 . 11  }
 12 is  
13 is  // global variables initialized 
14 the QImage GlobalVariable :: GV_QImage;

 

 

.cpp need to use the procedure in

GlobalVariable::GV_QImage = XXXXXX;

Guess you like

Origin www.cnblogs.com/ybqjymy/p/12156783.html