Quote Originally Posted by spirit View Post
It's an interesting interpretation, but I would make this in other way: make this object as a singleton
Qt Code:
  1. class Global: public QObject
  2. {
  3. Q_OBJECT
  4.  
  5. public:
  6. static Global *instance();
  7.  
  8. void send_name(const QString &color_name);
  9. ...
  10.  
  11. Q_SIGNALS:
  12. void send_color(const QString &color_name);
  13.  
  14. private:
  15. Q_DISABLE_COPY(Global);
  16. };
  17.  
  18. #define myGlobal Global::instance() //shortcut
To copy to clipboard, switch view to plain text mode 

Then
Qt Code:
  1. ...
  2. connect(myGlobal, SIGNAL(send_color(const QString &)), SLOT(applyColor(const QString &)));
  3. ...
  4. myGlobal->send_name("lightgray");
To copy to clipboard, switch view to plain text mode 
Thanks for your reply but I am not 100% sure that I understand your code. I want to call a Global static function from my MainWindow class, let's say
Qt Code:
  1. Global::set_new_color();
To copy to clipboard, switch view to plain text mode 
and then, from within set_new_color I want to send a message back to mainwindow getting the color_name. From your code I assume that the send_name function then emits the send_color signal? If I use
Qt Code:
  1. Q_EMIT send_color(color_name);
To copy to clipboard, switch view to plain text mode 
it doesn't let me emit it without an object... And I cannot create a new Global instance, because, as far as I understood from your code, Q_DISABLE_COPY avoids me from doing so...

If you want, I will provide you with example files.