Hi

I am having a bizarre problem with Q_OBJECT macro, if I include the maco in my class declaration the program does not run with the error

"You can't do that without a process to debug"

Qt Code:
  1. #include <qwt_plot.h>
  2.  
  3. class QSpinBox;
  4. class QDialog;
  5. class Fitting;
  6.  
  7. ////////////////////////////////////////////////////////////////////////////////////////////////////////////////
  8. class FittingPlot : public QwtPlot
  9. {
  10. Q_OBJECT //the program runs if this is if commented out
  11.  
  12. public:
  13. FittingPlot(QWidget *parent = NULL);
  14.  
  15. public slots:
  16. void upd();
  17.  
  18. private:
  19. QSpinBox* aSpinBox;
  20. QSpinBox* bSpinBox;
  21. QVBoxLayout* layout;
  22. QDialog* diag;
  23.  
  24. Fitting* tfit;
  25. int mtest;
  26. };
To copy to clipboard, switch view to plain text mode 

This the implementation

Qt Code:
  1. #include <qwt_plot.h>
  2. #include <QtGui>
  3.  
  4. #include "FittingPlot.h"
  5. #include "Fitting.h"
  6.  
  7. FittingPlot::FittingPlot(QWidget *parent)
  8. :QwtPlot(parent),mtest(0)
  9.  
  10. {
  11. aSpinBox = new QSpinBox;
  12. bSpinBox = new QSpinBox;
  13. layout = new QVBoxLayout();
  14. layout->addWidget(aSpinBox);
  15. layout->addWidget(bSpinBox);
  16. diag=new QDialog(this);
  17. diag->setLayout(layout);
  18. diag->show();
  19.  
  20. tfit=new Fitting();
  21.  
  22. QObject::connect(aSpinBox,SIGNAL(valueChanged(int)),tfit, SLOT(setTargetThreshold(int)) );
  23. QObject::connect(aSpinBox,SIGNAL(valueChanged(int)),tfit, SLOT(run()) );
  24. QObject::connect(aSpinBox,SIGNAL(valueChanged(int)),this, SLOT(upd()) );
  25. }
  26.  
  27. void
  28. FittingPlot::upd()
  29. {
  30. mtest++;
  31. }
To copy to clipboard, switch view to plain text mode 

When the code does run (with Q_OBJECT commnented out, the slot upd does not get called with warnin message

"warning: Object::connect: No such slot QwtPlot::upd()

The other two slots work in the Fitting Class work OK

Does anyone have any ideas why this is happening?