I have the following class:
class MySqlTableModel : public QSqlRelationalTableModel
{
//Q_OBJECT
public:
MySqlTableModel();
QSqlQuery add;
QSqlQuery login;
QSqlQuery logout;
void addUser(QString text);
virtual Qt::ItemFlags flags(const QModelIndex &index) const;
bool adding = false;
public slots:
void loginSlot();
void logoutSlot();
};
Which derives from QSqlRelationalTableModel
. I want to use some extra slots. My issue is, that if I comment the Q_OBJECT
tag out, the slots are not recognized, and not connected(QObject::connect: No such slot QSqlRelationalTableModel::MySqlTableModel::loginSlot()
). If I add the Q_OBJECT
tag, however, I get an error: /mysqltablemodel.cpp:5: error: undefined reference to vtable for MySqlTableModel'
, marking my constructor:
MySqlTableModel::MySqlTableModel()
{
}
[EDIT] Running qmake solved the compile error, but connect still doesn't seem to work. Am I doing something wrong here? Thank you!