Answer the question
In order to leave comments, you need to log in
How to write the value of QLineEdit to a variable?
The following files attempt to implement a user authorization dialog in the database:
autorization.h
#ifndef AUTORIZATION_H
#define AUTORIZATION_H
#include <QWidget>
namespace Ui {
class Autorization;
}
class Autorization : public QWidget
{
Q_OBJECT
public:
explicit Autorization(QWidget *parent = 0);
~Autorization();
private slots:
void on_autorizOK_clicked();
private:
Ui::Autorization *ui;
};
#endif // AUTORIZATION_H
#include "autorization.h"
#include "ui_autorization.h"
#include "autorization.h"
#include <QtSql/QSqlQuery>
#include <QSqlDatabase>
#include <QDebug>
#include <QSqlError>
#include "QString"
Autorization::Autorization(QWidget *parent) :
QWidget(parent),
ui(new Ui::Autorization)
{
ui->setupUi(this);
}
Autorization::~Autorization()
{
delete ui;
}
void on_autorisOK_clicked()
{
QString userName = autorizUser->text();
QString userPass = autorizPass->text();
}
Answer the question
In order to leave comments, you need to log in
Solved the problem in this way
:
void on_autorisOK_clicked()
{
QString userName = autorizUser->text();
QString userPass = autorizPass->text();
}
void Autorization::on_autorizOK_clicked()
{
QString userName = ui->autorizUser->text();
QString userPass = ui->autorizPass->text();
}
Try this.
void on_autorisOK_clicked()
{
QString userName = ui->autorizUser->text();
QString userPass = ui->autorizPass->text();
}
If you have on_autorisOK_clicked() - a slot (below in the text, by the way, a different name), then it must be in the class, and not just like that. Next, the GUI is accessed via ui.element_name->...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question