   Problem with Qt slots
  Hi everyone. Just began using Qt for some project, and already found something I don't know how to get around of.I've made a QDialog dependent of a QMainWindow. My idea is to take some values from inside the QDialog and use them to call a method of the parent on clicking OK, but something is wrong. Here's the code:class SetSizeDialog : public QDialog{public:SetSizeDialog(MainWindow *parent);private slots:void pressOK();private:(...)QDialogButtonBox *buttonBox;};SetSizeDialog::SetSizeDialog(MainWindow *parent) : QDialog(parent){(...)buttonBox = new QDialogButtonBox(QDialogButtonBox::Ok | QDialogButtonBox::Cancel);connect(buttonBox, SIGNAL(accepted()), this, SLOT(pressOK()));connect(buttonBox, SIGNAL(rejected()), this, SLOT(reject()));(...)}void SetTileSizeDialog::pressOK(){/* do things */accept();}My problem happens in execution time. When I make the QDialog appear, the console outputs the following line:Object::connect: No such slot QDialog::pressOK() in setsizedialog.cpp:39and of course, clicking the OK button does nothing. I can see the program is looking for the slot in the QDialog class. Why is that? I wrote "this" in the receiver field of the "connect" function, and "this" is a SetSizeDialog, so why is it looking for the slot in a different class? And which is the correct way to do what I'm trying to accomplish?Thanks in advance to anyone who can help.   
  I think you are missing the Q_OBJECT; macro in your class.// YourHeader.hclass SetSizeDialog : public QDialog{Q_OBJECT;  // This tells qmake to create a moc for this classpublic:SetSizeDialog(MainWindow *parent);private slots:void pressOK();private:(...)QDialogButtonBox *buttonBox;};Don't forget to register the header in your .pro file !;  Thanks, Maddi: I was, in fact, missing the Q_OBJECT macro!However, that made lots of other error messages appear, telling me about undefined references for functions Qt made by itself... oh, well, I'll try the rest by myself. Thanks a lot!   ;  Thats most probably because you a) didn't put the header into your .pro file ( HEADERS += SetSizeDialog.h ) or b) you did not do "qmake" after putting it in there.Glad I could help   