Reputation: 39
I have file programm.cpp that control all of my connecting page but when I want to connect one of programm.cpp functions to other push button from another class I gave an error
this is the code :
QObject::connect(LoginPage->Buttons->button(QDialogButtonBox::Ok),SIGNAL(clicked()),this,SLOT(check_user()));
and this is the error :
/home/alireza/Documents/qt/ALIREZA/programm.cpp:19: error: no matching function for call to 'QObject::connect(QPushButton*, const char*, programm* const, const char*)'
& also this is the function declaration that completely commented :
void programm::check_user()
{
/*QString user = LoginPage->EditPassWord->displayText();
QString password = LoginPage->ComboUsername->currentText();
QSqlQuery myquery("SELECT Username FROM TeacherUsers");
while(myquery.next())
{
QString Username = MyDB->query->value(0).toString();
QString pass = MyDB->query->value(1).toString();
qDebug()<<Username << " " << pass ;
//if (Username == user)
}*/
}
programm.h :
#ifndef PROGRAMM_H
#define PROGRAMM_H
#include "login.h"
#include "mainwindow.h"
#include "nazem.h"
#include "database.h"
#include <QtGui>
#include <QtCore>
#include <QObject>
class programm
{
Q_OBJECT
public:
programm();
Login *LoginPage;
MainWindow *MainWindowPage;
nazem *nazm;
database *MyDB;
public slots :
void check_user();
};
#endif // PROGRAMM_H
Upvotes: 0
Views: 119
Reputation: 22366
Like I said in comments... You haven't derived from QObject
and you haven't included the Q_OBJECT
macro.
Read the docs.
Upvotes: 2