[Interest] Most simple emit from singleton?

Jason H jhihn at gmx.com
Wed Nov 13 17:28:28 CET 2019


I've stumbled across a paradigm that I am starting to use frequently where I have a singleton, and I want it to emit something when I tell it to.

So I've been providing a function and doing: MySingleton::instance()->emitMySignal();

Where:
void MySingleton::emitMySignal() {
    emit mySignal();
}

But this seems "silly". Is there a better way to do this? Ideally I'd like to skip creating the function and do something like:

MySingleton::instance()->emit MySignal();
or
emit MySingleton::instance()->MySignal();


There may still be a better way?

Thoughts?

Thanks!



More information about the Interest mailing list