mirror of
https://github.com/itay-grudev/SingleApplication.git
synced 2025-01-15 17:02:06 +08:00
Improved QAPPLICATION_CLASS macro
Now it can be defined in the cpp file that include it (usually main.cpp).
This commit is contained in:
parent
e97a1e6b10
commit
bf00721b9c
@ -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:__
|
||||||
|
|
||||||
|
@ -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)
|
||||||
|
Loading…
Reference in New Issue
Block a user