[argento] OTP Pin management
This commit is contained in:
parent
6fa30bd81d
commit
82a9879f28
|
@ -34,7 +34,7 @@ EditWindow::EditWindow(int idSocio, QWidget* parent) : QMainWindow(parent), ui(n
|
||||||
ui->comboFonte->setModel(fonteModel);
|
ui->comboFonte->setModel(fonteModel);
|
||||||
ui->comboFonte->setModelColumn(fonteModel->fieldIndex("fonte"));
|
ui->comboFonte->setModelColumn(fonteModel->fieldIndex("fonte"));
|
||||||
|
|
||||||
QDataWidgetMapper* mapper = new QDataWidgetMapper(this);
|
mapper = new QDataWidgetMapper(this);
|
||||||
mapper->setModel(model);
|
mapper->setModel(model);
|
||||||
mapper->setItemDelegate(new QSqlRelationalDelegate(this));
|
mapper->setItemDelegate(new QSqlRelationalDelegate(this));
|
||||||
mapper->addMapping(ui->lineID, model->fieldIndex("id"));
|
mapper->addMapping(ui->lineID, model->fieldIndex("id"));
|
||||||
|
@ -45,9 +45,10 @@ EditWindow::EditWindow(int idSocio, QWidget* parent) : QMainWindow(parent), ui(n
|
||||||
mapper->addMapping(ui->lineEmail, model->fieldIndex("email"));
|
mapper->addMapping(ui->lineEmail, model->fieldIndex("email"));
|
||||||
mapper->addMapping(ui->comboProfessione, professioneIdx);
|
mapper->addMapping(ui->comboProfessione, professioneIdx);
|
||||||
mapper->addMapping(ui->comboFonte, fonteIdx);
|
mapper->addMapping(ui->comboFonte, fonteIdx);
|
||||||
|
mapper->addMapping(ui->checkAbilitaQuestionario, model->fieldIndex("abilitaQuestionario"));
|
||||||
|
mapper->addMapping(ui->linePin, model->fieldIndex("pin"));
|
||||||
|
|
||||||
mapper->toFirst();
|
mapper->toFirst();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void EditWindow::on_buttonSalva_clicked() {
|
void EditWindow::on_buttonSalva_clicked() {
|
||||||
|
@ -58,6 +59,9 @@ void EditWindow::on_buttonSalva_clicked() {
|
||||||
if (model->submitAll()) {
|
if (model->submitAll()) {
|
||||||
model->database().commit();
|
model->database().commit();
|
||||||
Ui::status(Ui::SUCCESS, "successfull update");
|
Ui::status(Ui::SUCCESS, "successfull update");
|
||||||
|
/* update ui */
|
||||||
|
model->select();
|
||||||
|
mapper->toFirst();
|
||||||
} else {
|
} else {
|
||||||
model->database().rollback();
|
model->database().rollback();
|
||||||
qDebug() << model->lastError();
|
qDebug() << model->lastError();
|
||||||
|
@ -75,6 +79,7 @@ void EditWindow::on_buttonAnnulla_clicked() {
|
||||||
|
|
||||||
EditWindow::~EditWindow()
|
EditWindow::~EditWindow()
|
||||||
{
|
{
|
||||||
|
delete mapper;
|
||||||
delete model;
|
delete model;
|
||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,6 +33,7 @@ private slots:
|
||||||
private:
|
private:
|
||||||
QSqlQuery query;
|
QSqlQuery query;
|
||||||
QSqlRelationalTableModel* model = nullptr;
|
QSqlRelationalTableModel* model = nullptr;
|
||||||
|
QDataWidgetMapper* mapper = nullptr;
|
||||||
|
|
||||||
Ui::EditWindow *ui;
|
Ui::EditWindow *ui;
|
||||||
};
|
};
|
||||||
|
|
|
@ -257,14 +257,14 @@
|
||||||
<widget class="QCheckBox" name="checkAbilitaQuestionario">
|
<widget class="QCheckBox" name="checkAbilitaQuestionario">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>120</x>
|
<x>450</x>
|
||||||
<y>180</y>
|
<y>170</y>
|
||||||
<width>151</width>
|
<width>71</width>
|
||||||
<height>31</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Abilita compilazione</string>
|
<string>Abilita</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QDateEdit" name="dateDataCompilazione">
|
<widget class="QDateEdit" name="dateDataCompilazione">
|
||||||
|
@ -273,8 +273,8 @@
|
||||||
</property>
|
</property>
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>230</x>
|
||||||
<y>180</y>
|
<y>170</y>
|
||||||
<width>101</width>
|
<width>101</width>
|
||||||
<height>32</height>
|
<height>32</height>
|
||||||
</rect>
|
</rect>
|
||||||
|
@ -293,13 +293,13 @@
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>10</x>
|
||||||
<y>160</y>
|
<y>170</y>
|
||||||
<width>201</width>
|
<width>80</width>
|
||||||
<height>21</height>
|
<height>31</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Data compilazione questionario</string>
|
<string>Questionario</string>
|
||||||
</property>
|
</property>
|
||||||
<property name="wordWrap">
|
<property name="wordWrap">
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
|
@ -318,6 +318,54 @@
|
||||||
<string>Annulla</string>
|
<string>Annulla</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_12">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>100</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>131</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>Ultima compilazione</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLineEdit" name="linePin">
|
||||||
|
<property name="enabled">
|
||||||
|
<bool>false</bool>
|
||||||
|
</property>
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>370</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>71</width>
|
||||||
|
<height>32</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="readOnly">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
|
<widget class="QLabel" name="label_13">
|
||||||
|
<property name="geometry">
|
||||||
|
<rect>
|
||||||
|
<x>340</x>
|
||||||
|
<y>170</y>
|
||||||
|
<width>31</width>
|
||||||
|
<height>31</height>
|
||||||
|
</rect>
|
||||||
|
</property>
|
||||||
|
<property name="text">
|
||||||
|
<string>OTP</string>
|
||||||
|
</property>
|
||||||
|
<property name="wordWrap">
|
||||||
|
<bool>true</bool>
|
||||||
|
</property>
|
||||||
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
<layoutdefault spacing="6" margin="11"/>
|
<layoutdefault spacing="6" margin="11"/>
|
||||||
|
|
Loading…
Reference in New Issue