Simple GlobalValues use QApplication property
This commit is contained in:
32
src/appvals/AppGlobalValues.h
Normal file
32
src/appvals/AppGlobalValues.h
Normal 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
|
||||
Reference in New Issue
Block a user