Hi,
I have two classes, UserConfiguration and UserCreationDialog, in my C++ Qt Project. I need to make a connection between a signal from UserCreationDialog, when OK button is pressed and the slot update() in UserConfiguration. The connection is seen in my code below. But when I build, I get the error:
"[...] usercreationdialog.cpp:13: error: no matching function for call to 'UserCreationDialog::connect(UserCreationDialog*, const char*, UserConfiguration**, const char*)' connect(this, SIGNAL(updateUserConfig()),&uconf,SLOT(update()));"
"[...] usercreationdialog.cpp:13: error: no matching function for call to 'UserCreationDialog::connect(UserCreationDialog*, const char*, UserConfiguration**, const char*)' connect(this, SIGNAL(updateUserConfig()),&uconf,SLOT(update()));"
To copy to clipboard, switch view to plain text mode
^
UserCreationDialog.h
#ifndef USERCREATIONDIALOG_H
#define USERCREATIONDIALOG_H
#include <QDialog>
class UserConfiguration;
namespace Ui {
class UserCreationDialog;
}
class UserCreationDialog
: public QDialog{
Q_OBJECT
public:
explicit UserCreationDialog
(QWidget *parent
= 0);
~UserCreationDialog();
private slots:
void on_buttonBox_accepted();
private:
Ui::UserCreationDialog *ui;
UserConfiguration *uconf;
signals:
void updateUserConfig();
};
#endif // USERCREATIONDIALOG_H
#ifndef USERCREATIONDIALOG_H
#define USERCREATIONDIALOG_H
#include <QDialog>
class UserConfiguration;
namespace Ui {
class UserCreationDialog;
}
class UserCreationDialog : public QDialog
{
Q_OBJECT
public:
explicit UserCreationDialog(QWidget *parent = 0);
~UserCreationDialog();
private slots:
void on_buttonBox_accepted();
private:
Ui::UserCreationDialog *ui;
UserConfiguration *uconf;
QSqlDatabase* fv_db;
signals:
void updateUserConfig();
};
#endif // USERCREATIONDIALOG_H
To copy to clipboard, switch view to plain text mode
UserCreationDialog.cpp
#include "usercreationdialog.h"
#include "ui_usercreationdialog.h"
#include "userconfiguration.h"
UserCreationDialog
::UserCreationDialog(QWidget *parent
) : ui(new Ui::UserCreationDialog)
{
ui->setupUi(this);
connect(this, SIGNAL(updateUserConfig()),&uconf,SLOT(update()));
}
UserCreationDialog::~UserCreationDialog()
{
delete ui;
}
void UserCreationDialog::on_buttonBox_accepted()
{
QString uid
= ui
->userIDLineEdit
->text
();
QString pw
= ui
->passwordLineEdit
->text
();
writeUserToDb(uid,pw, *fv_db);
emit updateUserConfig();
close();
}
#include "usercreationdialog.h"
#include "ui_usercreationdialog.h"
#include "userconfiguration.h"
UserCreationDialog::UserCreationDialog(QWidget *parent) :
QDialog(parent),
ui(new Ui::UserCreationDialog)
{
ui->setupUi(this);
connect(this, SIGNAL(updateUserConfig()),&uconf,SLOT(update()));
}
UserCreationDialog::~UserCreationDialog()
{
delete ui;
}
void UserCreationDialog::on_buttonBox_accepted()
{
QString uid = ui->userIDLineEdit->text();
QString pw = ui->passwordLineEdit->text();
writeUserToDb(uid,pw, *fv_db);
emit updateUserConfig();
close();
}
To copy to clipboard, switch view to plain text mode
Some irrelevant code is left out from the shown code above.
// Leutzig
Bookmarks