title: Emit a signal from another class
body: <p>I have this code, structured in 2 *.cpp files and 2 *.h files, and I simply don't understand how to send a signal from one class to another:</p>
  
  <p>I have <strong>mainwindow.cpp</strong>:</p>
  
  <pre><code>#include "mainwindow.h"
  #include "ui_mainwindow.h"
  #include "serialcommunication.h"
  #include "QDebug"
  
  MainWindow::MainWindow(QWidget *parent) :
      QMainWindow(parent),
      ui(new Ui::MainWindow)
  {
      ui-&gt;setupUi(this);
      //other functions;
  
  }
  
  MainWindow::~MainWindow()
  {
      delete ui;
      //Here is where I want to emit the signal
      qDebug() &lt;&lt; "DONE!";
  }
  </code></pre>
  
  <p>This is the <strong>header</strong> for mainwindow.cpp:</p>
  
  <pre><code>class MainWindow : public QMainWindow
  {
      Q_OBJECT
  public:
      explicit MainWindow(QWidget *parent = nullptr);
      ~MainWindow();
  private slots:
      void on_connectButton_clicked();
  
  private:
      Ui::MainWindow *ui;
  
  };
  </code></pre>
  
  <p>So, I want tot send a signal from mainwindow class to serialcomunication class, to invoke a function here:</p>
  
  <p>Second *.cpp file: <strong>Serialcommunication.cpp</strong>:</p>
  
  <pre><code>#include "serialcommunication.h"
  #include "mainwindow.h"
  
  SerialCommunication::SerialCommunication(QObject *parent) : QObject(parent)
  {   
      isStopReadConsoleActivated = false;
  
  
      QtConcurrent::run(this,&amp;SerialCommunication::readConsole,isStopReadConsoleActivated);
  
      }
      void FUNCTION THANT I WANT TO BE CALLED FROM MAINWINDOW CLASS()
      {
  //DO SOMETHING
      }
  </code></pre>
  
  <p>And the serialcommunication <strong>header</strong>:</p>
  
  <pre><code>class SerialCommunication : public QObject
  {
       Q_OBJECT
  private:
  
      //some other fucntions
  
  public:
      explicit SerialCommunication(QObject *parent = nullptr);
       ~SerialCommunication();
  };
  </code></pre>
  
  <p>Where I need to put the slot, the signal and the connect method? Thank a lot!</p>