From 51b8435880013f1d4533379811a9b89c1ea3173c Mon Sep 17 00:00:00 2001 From: Arno Date: Sun, 4 Sep 2016 17:06:53 +0200 Subject: Make QActions local to FileWidget Introduce Globals singleton for global actions. --- globals.h | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 globals.h (limited to 'globals.h') diff --git a/globals.h b/globals.h new file mode 100644 index 0000000..f659088 --- /dev/null +++ b/globals.h @@ -0,0 +1,25 @@ +#ifndef GLOBALS_H +#define GLOBALS_H + +#include +#include + +class QAction; + +class Globals : public QObject { + Q_OBJECT + public: + enum ActionType { QuitAction = 0, ConfigAction = 1 }; + static Globals *instance(); + void addAction(QAction *a); + QAction *action(int actionType); + + private: + Globals(); + Globals(const Globals &other); + Globals &operator=(const Globals &other); + static Globals *mInstance; + QHash mActions; +}; + +#endif // GLOBALS_H -- cgit v1.2.3-70-g09d2