Solved public slots: - not always works?
-
I have
class ConfigDialog : public QDialog { void keyPressEvent(QKeyEvent *event); QLineEdit *syntaxPath; QLineEdit *themesPath; void load(Config *config); void save(Config *config); Config *configRef; public slots: void browse(QLineEdit *line); void applySlot(); void okSlot(); public: ConfigDialog(Config *config, QWidget *parent); };
and in debug directory not exists moc_configdialog.o/cpp nor configdialog.moc whereas exists moc_codeeditor.cpp,moc_tabwindow.cpp ,codeeditor.moc
connect(btnOk, SIGNAL(clicked()), this, SLOT(okSlot()));
compiled but not works,
connect(btnOk, &QAbstractButton::clicked, this, [this]{ okSlot(); });
works
-
You missed adding Q_OBJECT macro in private section of your class
-
After adding I have:
undefined reference to `vtable for ConfigDialog'
undefined reference to `ConfigDialog::staticMetaObject'
Is Ok, after deleting debug directory, Thanks it is solved.
-
Delete the build directory and build the project again