title: QT how to pass variables to main window
body: <p>I am very new to QT and C++, I need to pass some variables to main window ( i.e: int a, double b, int c ...). Over the internet they say using global variables is not an appropriate way to achieve it. So I need to use signal-slot approach. But I have no idea how to use signal slot to pass variables to different window. In that case should I declare slot in the current window and slot to another window? Would something like this work:</p>
  
  <pre><code>//somewhere in the current window
   int a=10;
   connect (&amp;a, &amp;QPushButton::pressed(), mainwindow, &amp;b);
  
  //In main window
  int b;
  </code></pre>