Minor fixes to make it run on Linux
This commit is contained in:
parent
5d8a743d20
commit
aefe4ba9cd
|
@ -1,10 +1,7 @@
|
||||||
#include "EditWindow.h"
|
#include "EditWindow.h"
|
||||||
#include "ui_EditWindow.h"
|
#include "ui_EditWindow.h"
|
||||||
|
|
||||||
EditWindow::EditWindow(int idSocio, QString pin, QWidget *parent) :
|
EditWindow::EditWindow(int idSocio, QWidget* parent) : QMainWindow(parent), ui(new Ui::EditWindow) {
|
||||||
QMainWindow(parent),
|
|
||||||
ui(new Ui::EditWindow)
|
|
||||||
{
|
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
if (!db.open()) {
|
if (!db.open()) {
|
||||||
|
@ -21,10 +18,10 @@ EditWindow::EditWindow(int idSocio, QString pin, QWidget *parent) :
|
||||||
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
model->setEditStrategy(QSqlTableModel::OnManualSubmit);
|
||||||
|
|
||||||
// Indici dei campi in join
|
// Indici dei campi in join
|
||||||
//professioneIdx = model->fieldIndex("professione");
|
professioneIdx = model->fieldIndex("professione");
|
||||||
//fonteIdx = model->fieldIndex("fonte");
|
fonteIdx = model->fieldIndex("fonte");
|
||||||
|
|
||||||
// La strategia di join da usare per le rleazioni e' LeftJoin
|
// La strategia di join da usare per le relazioni è LeftJoin
|
||||||
model->setJoinMode(QSqlRelationalTableModel::LeftJoin);
|
model->setJoinMode(QSqlRelationalTableModel::LeftJoin);
|
||||||
|
|
||||||
// Imposta le relazioni
|
// Imposta le relazioni
|
||||||
|
@ -73,6 +70,7 @@ void EditWindow::showError(const QSqlError &err)
|
||||||
|
|
||||||
EditWindow::~EditWindow()
|
EditWindow::~EditWindow()
|
||||||
{
|
{
|
||||||
|
delete model;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,7 +17,7 @@ class EditWindow : public QMainWindow
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
explicit EditWindow(int idSocio, QString pin, QWidget *parent = nullptr);
|
explicit EditWindow(int idSocio, QWidget* parent = nullptr);
|
||||||
~EditWindow();
|
~EditWindow();
|
||||||
|
|
||||||
bool doNotShow = false;
|
bool doNotShow = false;
|
||||||
|
|
|
@ -72,7 +72,7 @@ void Pin::on_pushButtonOk_clicked()
|
||||||
// delle editwindow
|
// delle editwindow
|
||||||
// Un socio e' valido se ha idSocio maggiore di zero
|
// Un socio e' valido se ha idSocio maggiore di zero
|
||||||
if (idSocio > 0) {
|
if (idSocio > 0) {
|
||||||
EditWindow *ew = new EditWindow(idSocio, pin, this);
|
EditWindow *ew = new EditWindow(idSocio, this);
|
||||||
ew->setAttribute(Qt::WA_DeleteOnClose);
|
ew->setAttribute(Qt::WA_DeleteOnClose);
|
||||||
ew->setWindowModality(Qt::ApplicationModal);
|
ew->setWindowModality(Qt::ApplicationModal);
|
||||||
if (!ew->doNotShow) {
|
if (!ew->doNotShow) {
|
||||||
|
|
|
@ -10,10 +10,10 @@ void connectDatabase() {
|
||||||
/* open database and attach query */
|
/* open database and attach query */
|
||||||
db = QSqlDatabase::addDatabase("QMYSQL"); /* QMYSQL <-- database driver */
|
db = QSqlDatabase::addDatabase("QMYSQL"); /* QMYSQL <-- database driver */
|
||||||
|
|
||||||
// db.setHostName(settings.value("hostname").toString());
|
db.setHostName(settings.value("hostname").toString());
|
||||||
// db.setDatabaseName(settings.value("database").toString());
|
db.setDatabaseName(settings.value("database").toString());
|
||||||
// db.setUserName(settings.value("username").toString());
|
db.setUserName(settings.value("username").toString());
|
||||||
// db.setPassword(settings.value("password").toString());
|
db.setPassword(settings.value("password").toString());
|
||||||
|
|
||||||
// db.setHostName(settings.value("hostname","serverozzo.golem.linux.it").toString());
|
// db.setHostName(settings.value("hostname","serverozzo.golem.linux.it").toString());
|
||||||
// db.setDatabaseName(settings.value("database","golem_gestionale").toString());
|
// db.setDatabaseName(settings.value("database","golem_gestionale").toString());
|
||||||
|
@ -21,17 +21,17 @@ void connectDatabase() {
|
||||||
// db.setUserName(settings.value("username").toString());
|
// db.setUserName(settings.value("username").toString());
|
||||||
// db.setPassword(settings.value("password").toString());
|
// db.setPassword(settings.value("password").toString());
|
||||||
|
|
||||||
QString hostname = settings.value("hostname","localhost").toString();
|
// QString hostname = settings.value("hostname","localhost").toString();
|
||||||
QString database = settings.value("database","golem_gestionale").toString();
|
// QString database = settings.value("database","golem_gestionale").toString();
|
||||||
int port = settings.value("port", "3306").toInt();
|
// int port = settings.value("port", "3306").toInt();
|
||||||
QString username = settings.value("username", "admin").toString();
|
// QString username = settings.value("username", "admin").toString();
|
||||||
QString password = settings.value("password", "password").toString();
|
// QString password = settings.value("password", "password").toString();
|
||||||
|
|
||||||
db.setHostName(hostname);
|
// db.setHostName(hostname);
|
||||||
db.setDatabaseName(database);
|
// db.setDatabaseName(database);
|
||||||
db.setPort(port);
|
// db.setPort(port);
|
||||||
db.setUserName(username);
|
// db.setUserName(username);
|
||||||
db.setPassword(password);
|
// db.setPassword(password);
|
||||||
|
|
||||||
// query = QSqlQuery(db);
|
// query = QSqlQuery(db);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue