Compare commits
3 Commits
385f284047
...
ba6faaaf7e
| Author | SHA1 | Date |
|---|---|---|
|
|
ba6faaaf7e | |
|
|
89080b7c6b | |
|
|
ef2b2a072e |
12
auth.cpp
12
auth.cpp
|
|
@ -33,4 +33,16 @@ auth::auth (QWidget *parent)
|
||||||
void
|
void
|
||||||
auth::onAuth ()
|
auth::onAuth ()
|
||||||
{
|
{
|
||||||
|
QSqlDatabase *db = new QSqlDatabase(QSqlDatabase::addDatabase("QPSQL"));
|
||||||
|
db->setHostName(_addressEdit->text());
|
||||||
|
db->setPort(_portEdit->text().toInt());
|
||||||
|
db->setDatabaseName("cards");
|
||||||
|
db->setUserName(_nicknameEdit->text());
|
||||||
|
db->setPassword(_passwordEdit->text());
|
||||||
|
bool ok = db->open();
|
||||||
|
if (ok) {
|
||||||
|
emit dbOpenned(db);
|
||||||
|
}
|
||||||
|
|
||||||
|
close();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
2
auth.h
2
auth.h
|
|
@ -4,6 +4,7 @@
|
||||||
#include <QLabel>
|
#include <QLabel>
|
||||||
#include <QLineEdit>
|
#include <QLineEdit>
|
||||||
#include <QPushButton>
|
#include <QPushButton>
|
||||||
|
#include <QSqlDatabase>
|
||||||
#include <QVBoxLayout>
|
#include <QVBoxLayout>
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
|
@ -28,6 +29,7 @@ private:
|
||||||
public slots:
|
public slots:
|
||||||
void onAuth ();
|
void onAuth ();
|
||||||
signals:
|
signals:
|
||||||
|
void dbOpenned(QSqlDatabase *);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif // AUTH_H
|
#endif // AUTH_H
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue