title: QT: No Such Slot
body: <p>Problem is that I keep getting the 'No Such Slot' runtime error in Qt Creator every time I launch a 'settings' window from my main window. I've found Qt to be quite counter-intuitive so far and this slots 'n signals concept seems a bit of a stretch from simply passing vars or function calls. Basically, I have menu with a settings option, that when clicked, opens a settings window which needs to grab a double from the user and update a var in the main window.</p>
  
  <p>SettingsWindow.h</p>
  
  <pre><code>class SettingsWindow : public QWidget
  {
        Q_OBJECT
    public:
        SettingsWindow(QWidget *parent = 0);
    signals:
        void ValChanged(double newVal);
    public slots:
        void Accept();
    private:
        QLineEdit *le1;
  };
  </code></pre>
  
  <p>The settings window has an accept button which calls Accept() which emits the ValChanged signal with newVal set as the user input in le1 as a double.</p>
  
  <p>SettingsWindow.cpp</p>
  
  <pre><code>void SettingsWindow::Accept(){
      emit ValChanged(le1-&gt;text().toDouble());
      this-&gt;close();
  }
  </code></pre>
  
  <p>This settings window is called by the application's main window: MainWindow</p>
  
  <p>MainWindow.cpp</p>
  
  <pre><code>class MainWindow : public QMainWindow
  {
        Q_OBJECT  
    public:
        MainWindow(QWidget *parent = 0);
    public slots:
        void SetVal(double x);
    private slots:
        void NewWindow();
    private:
        double theVal;
  };
  </code></pre>
  
  <p>This main window has a menu which one would select settings from. This creates a new window with a field for one to enter a number.</p>
  
  <p>MainWindow.cpp</p>
  
  <pre><code>void MainWindow::NewWindow()
  {
      SettingsWindow *MySettings=new SettingsWindow(this);
      QObject::connect(MySettings, SIGNAL(ValChanged(double)), this, SLOT(SetVal(double)));
      MySettings-&gt;show();
      MySettings-&gt;raise();
  }
  
  void MainWindow::SetVal(double x){
      theVal = x;
  }
  </code></pre>
  
  <p>My hope is that when the settings window is opened, the user can enter a val into the field which then emits the ValChanged Signal which sets theVal to the value specified by the user. Most of the time I saw an issue with people not including Q_OBJECT macro, but I've included it both times. Any suggestions on why this doesn't work?</p>