Simple GlobalValues use QApplication property

This commit is contained in:
Krad
2021-11-19 15:35:46 +08:00
parent 32ebb0722d
commit bca10e3e60

View File

@@ -0,0 +1,32 @@
//
// Created by Krad on 2021/11/19.
//
#ifndef GUI_APPGLOBALVALUES_H
#define GUI_APPGLOBALVALUES_H
#define APP_VALUES()\
ADD_APP_VALUE(InProcessing)\
ADD_APP_VALUE(LastOperationTime)\
ADD_APP_VALUE(LastOperation)
#include <QApplication>
#include <QVariant>
#include <QString>
class AppGlobalValues {
public:
#define ADD_APP_VALUE(name)\
static QVariant name(){\
return qApp->property(#name);\
}\
static void set##name(QVariant val){\
qApp->setProperty(#name, val);\
}
APP_VALUES()
#undef ADD_APP_VALUE
};
#endif //GUI_APPGLOBALVALUES_H