Improved QAPPLICATION_CLASS macro

Now it can be defined in the cpp file that include it (usually
main.cpp).
This commit is contained in:
Itay Grudev 2015-11-04 16:30:14 +00:00
parent e97a1e6b10
commit bf00721b9c
2 changed files with 4 additions and 2 deletions

View File

@ -42,7 +42,7 @@ Using ```QApplication::instance()``` is a neat way to get the ```SingleApplicati
Extending from other application classes Extending from other application classes
----------------------- -----------------------
```SingleApplication``` extends from the ```QApplication``` class by default , but you can easily change that to ```QGuiApplication``` or ```QCoreApplication``` from the ```singleapplication.h``` file, using the ```QAPPLICATION_CLASS``` macro. `SingleApplication` extends from the `QApplication` class by default , but you can easily change that to `QGuiApplication` or `QCoreApplication` with the `QAPPLICATION_CLASS` macro. Define it before the include statement of `singleapplication.h` or change the default value in the file.
__Example:__ __Example:__

View File

@ -2,7 +2,9 @@
#define SINGLE_APPLICATION_H #define SINGLE_APPLICATION_H
// Change this to inherit from QGuiApplication or QCoreApplication // Change this to inherit from QGuiApplication or QCoreApplication
#define QAPPLICATION_CLASS QApplication #ifndef QAPPLICATION_CLASS
#define QAPPLICATION_CLASS QCoreApplication
#endif
#define QUOTE(C) #C #define QUOTE(C) #C
#define INCLUDE_FILE(C) QUOTE(C) #define INCLUDE_FILE(C) QUOTE(C)