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.cpp | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 globals.cpp (limited to 'globals.cpp') diff --git a/globals.cpp b/globals.cpp new file mode 100644 index 0000000..2bdb175 --- /dev/null +++ b/globals.cpp @@ -0,0 +1,22 @@ +#include + +#include "globals.h" + +Globals *Globals::mInstance = nullptr; + +Globals *Globals::instance(){ + if(!mInstance){ + mInstance = new Globals; + } + return mInstance; +} + +void Globals::addAction(QAction *a){ + mActions.insert(a->data().toInt(), a); +} + +QAction *Globals::action(int actionType){ + return mActions.value(actionType); +} + +Globals::Globals(){} -- cgit v1.2.3-70-g09d2