Hello,

In the application I'm currently developping, I need to access (through setMode and getMode methods), from any classes, to a variable 'mode' that shows in which mode the application is.
I want other classes to be warned about changes of the value of this variables.
That's why I subclasses QApplication.
I cannot though access to this variable, this :

qDebug()<<QApplication_ac::instance()->getMode(); //here, the problem !

give the error :

class QCoreApplication' has no member named 'getMode'
qDebug()<<QApplication_ac::instance()->getMode();


How can I solve my problem ?

Many thanks for answer.

Here is the code :

qapplication_ac.h :

Qt Code:
  1. #ifndef QAPPLICATION_AC_H
  2. #define QAPPLICATION_AC_H
  3.  
  4. #include <QApplication>
  5.  
  6. enum Mode {NOTHING=0,
  7. PICKING_DETAIL,
  8. PANNING,
  9. ROTATION,
  10. PICKING_POINT,
  11. ABOUT_TO_CLOSE,
  12. POLYGON_FINISHED
  13. };
  14.  
  15. class QApplication_ac:public QApplication
  16. {
  17.  
  18. Q_OBJECT
  19.  
  20. public:
  21. QApplication_ac(int &argc, char *argv[]); //constuctor
  22. Mode mode;
  23. Mode getMode(){ return mode;}
  24. void setMode(Mode modeToSet);
  25.  
  26. signals:
  27.  
  28. void modeChanged(Mode newMode,Mode oldMode); //other classes will be connected to this signal
  29.  
  30. };
  31.  
  32. #endif // QAPPLICATION_AC_H
To copy to clipboard, switch view to plain text mode 

qapplication_ac.cpp :

Qt Code:
  1. #include "qapplication_ac.h"
  2.  
  3. QApplication_ac::QApplication_ac(int &argc, char *argv[]):
  4. QApplication(argc, argv)
  5.  
  6. {
  7. mode=NOTHING;
  8. }
  9.  
  10. void QApplication_ac::setMode(Mode modeToSet){
  11.  
  12. emit modeChanged(modeToSet,getMode());
  13.  
  14. mode=modeToSet;
  15. }
To copy to clipboard, switch view to plain text mode