I have a class called Global and it does a repetitive task once in a while via a static function... This function is called through many different classes so it is important to be static so as not to create objects all the time.

glob.h:
Qt Code:
  1. class Global: public QObject
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. static void send_name(QString color_name);
  7. ...
  8.  
  9. Q_SIGNALS:
  10. send_color(QString color_name);
  11. };
To copy to clipboard, switch view to plain text mode 

glob.cpp:
Qt Code:
  1. void Global::send_name(QString color_name){
  2. if(_window_loaded_){
  3. /*SEND MESSAGE WITH COLOR_NAME*/
  4. Q_EMIT send_color(color_name);
  5. }
  6. }
To copy to clipboard, switch view to plain text mode 

Inside my MainWindow class I have to connect the send_color message sent by my static function to a local function so as to update some gui content.

I know that there are many many threads about this but, believe me, I've searched all of them and nothing worked for me. I searched in depth the mailing lists and still nothing. I even tried to use QCustomEvent with qApplication->postEvent() but it is deprecated and it is suggested to use QEvent , which doesn't have setdata() function though, so it is no usable for this case (?)

I've spent my morning searching about this, so all suggestions are appreciated!