EditWindow purged, now it only does editing
This commit is contained in:
parent
61059d12c8
commit
6851637b7d
|
@ -38,7 +38,17 @@ EditWindow::EditWindow(int idSocio, QWidget* parent) : QMainWindow(parent), ui(n
|
||||||
query.exec();
|
query.exec();
|
||||||
query.first();
|
query.first();
|
||||||
|
|
||||||
showFound(); // TODO
|
/* show everything in the interface */
|
||||||
|
lineID->setText(query.value( query.record().indexOf("id") ).toString());
|
||||||
|
lineNome->setText(query.value( query.record().indexOf("nome") ).toString());
|
||||||
|
lineCognome->setText(query.value( query.record().indexOf("cognome") ).toString());
|
||||||
|
lineComuneResidenza->setText(query.value(query.record().indexOf("comuneResidenza")).toString());
|
||||||
|
lineEmail->setText(query.value(query.record().indexOf("email")).toString());
|
||||||
|
comboProfessione->setCurrentIndex(comboProfessione->findData(query.value(query.record().indexOf("professione")).toInt()));
|
||||||
|
comboFonte->setCurrentIndex(comboFonte->findData(query.value(query.record().indexOf("fonte")).toInt()));
|
||||||
|
dateDataNascita->setDate(QDate(1900, 1, 1)); dateDataNascita->setDate(query.value(query.record().indexOf("dataNascita")).toDate());
|
||||||
|
dateDataCompilazione->setDate(QDate(1900, 1, 1)); dateDataCompilazione->setDate(query.value(query.record().indexOf("dataCompilazione")).toDate());
|
||||||
|
checkAbilitaQuestionario->setChecked( query.value(query.record().indexOf("abilitaQuestionario")).toBool() );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -56,42 +66,7 @@ void EditWindow::on_buttonCerca_clicked() {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
void EditWindow::showFound() {
|
void EditWindow::on_buttonSalva_clicked() {
|
||||||
lineID->setText(query.value( query.record().indexOf("id") ).toString());
|
|
||||||
lineNome->setText(query.value( query.record().indexOf("nome") ).toString());
|
|
||||||
lineCognome->setText(query.value( query.record().indexOf("cognome") ).toString());
|
|
||||||
lineComuneResidenza->setText(query.value(query.record().indexOf("comuneResidenza")).toString());
|
|
||||||
lineEmail->setText(query.value(query.record().indexOf("email")).toString());
|
|
||||||
comboProfessione->setCurrentIndex(comboProfessione->findData(query.value(query.record().indexOf("professione")).toInt()));
|
|
||||||
comboFonte->setCurrentIndex(comboFonte->findData(query.value(query.record().indexOf("fonte")).toInt()));
|
|
||||||
dateDataNascita->setDate(QDate(1900, 1, 1)); dateDataNascita->setDate(query.value(query.record().indexOf("dataNascita")).toDate());
|
|
||||||
dateDataCompilazione->setDate(QDate(1900, 1, 1)); dateDataCompilazione->setDate(query.value(query.record().indexOf("dataCompilazione")).toDate());
|
|
||||||
checkAbilitaQuestionario->setChecked( query.value(query.record().indexOf("abilitaQuestionario")).toBool() );
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditWindow::on_buttonSuccessivo_clicked() {
|
|
||||||
if (! query.next()) {
|
|
||||||
query.last();
|
|
||||||
setStatus(Ui::INFO, "no more results");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
showFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditWindow::on_buttonPrecedente_clicked() {
|
|
||||||
if (! query.previous()) {
|
|
||||||
query.first();
|
|
||||||
setStatus(Ui::INFO, "no more results");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
showFound();
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditWindow::on_buttonNuovo_clicked() {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void EditWindow::on_buttonModifica_clicked() {
|
|
||||||
|
|
||||||
query.prepare("UPDATE socio \
|
query.prepare("UPDATE socio \
|
||||||
SET nome = NULLIF(:nome, ''), \
|
SET nome = NULLIF(:nome, ''), \
|
||||||
|
@ -142,6 +117,9 @@ void EditWindow::setStatus(Ui::StatusType type, QString message) {
|
||||||
statusBar->showMessage(message, timeout);
|
statusBar->showMessage(message, timeout);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void EditWindow::on_buttonAnnulla_clicked() {
|
||||||
|
this->close();
|
||||||
|
}
|
||||||
|
|
||||||
EditWindow::~EditWindow()
|
EditWindow::~EditWindow()
|
||||||
{
|
{
|
||||||
|
|
|
@ -33,10 +33,8 @@ public:
|
||||||
void setStatus(Ui::StatusType type, QString message);
|
void setStatus(Ui::StatusType type, QString message);
|
||||||
|
|
||||||
private slots:
|
private slots:
|
||||||
void on_buttonNuovo_clicked();
|
void on_buttonSalva_clicked();
|
||||||
void on_buttonModifica_clicked();
|
void on_buttonAnnulla_clicked();
|
||||||
void on_buttonSuccessivo_clicked();
|
|
||||||
void on_buttonPrecedente_clicked();
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
QLineEdit* lineID = nullptr;
|
QLineEdit* lineID = nullptr;
|
||||||
|
@ -53,8 +51,6 @@ private:
|
||||||
QSqlQuery query;
|
QSqlQuery query;
|
||||||
|
|
||||||
Ui::EditWindow *ui;
|
Ui::EditWindow *ui;
|
||||||
bool populateUi(void);
|
|
||||||
void showFound(void);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -241,56 +241,17 @@
|
||||||
<enum>Qt::Horizontal</enum>
|
<enum>Qt::Horizontal</enum>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="buttonCerca">
|
<widget class="QPushButton" name="buttonSalva">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>10</x>
|
<x>550</x>
|
||||||
<y>230</y>
|
<y>230</y>
|
||||||
<width>91</width>
|
<width>91</width>
|
||||||
<height>34</height>
|
<height>34</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Cerca</string>
|
<string>Salva</string>
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="buttonModifica">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>310</x>
|
|
||||||
<y>230</y>
|
|
||||||
<width>91</width>
|
|
||||||
<height>34</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Modifica</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="buttonPrecedente">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>110</x>
|
|
||||||
<y>230</y>
|
|
||||||
<width>91</width>
|
|
||||||
<height>34</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Precedente</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
<widget class="QPushButton" name="buttonSuccessivo">
|
|
||||||
<property name="geometry">
|
|
||||||
<rect>
|
|
||||||
<x>210</x>
|
|
||||||
<y>230</y>
|
|
||||||
<width>91</width>
|
|
||||||
<height>34</height>
|
|
||||||
</rect>
|
|
||||||
</property>
|
|
||||||
<property name="text">
|
|
||||||
<string>Successivo</string>
|
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QCheckBox" name="checkAbilitaQuestionario">
|
<widget class="QCheckBox" name="checkAbilitaQuestionario">
|
||||||
|
@ -344,17 +305,17 @@
|
||||||
<bool>true</bool>
|
<bool>true</bool>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
<widget class="QPushButton" name="buttonNuovo">
|
<widget class="QPushButton" name="buttonAnnulla">
|
||||||
<property name="geometry">
|
<property name="geometry">
|
||||||
<rect>
|
<rect>
|
||||||
<x>410</x>
|
<x>450</x>
|
||||||
<y>230</y>
|
<y>230</y>
|
||||||
<width>91</width>
|
<width>91</width>
|
||||||
<height>34</height>
|
<height>34</height>
|
||||||
</rect>
|
</rect>
|
||||||
</property>
|
</property>
|
||||||
<property name="text">
|
<property name="text">
|
||||||
<string>Nuovo</string>
|
<string>Annulla</string>
|
||||||
</property>
|
</property>
|
||||||
</widget>
|
</widget>
|
||||||
</widget>
|
</widget>
|
||||||
|
@ -372,10 +333,7 @@
|
||||||
<tabstop>comboFonte</tabstop>
|
<tabstop>comboFonte</tabstop>
|
||||||
<tabstop>dateDataCompilazione</tabstop>
|
<tabstop>dateDataCompilazione</tabstop>
|
||||||
<tabstop>checkAbilitaQuestionario</tabstop>
|
<tabstop>checkAbilitaQuestionario</tabstop>
|
||||||
<tabstop>buttonCerca</tabstop>
|
<tabstop>buttonSalva</tabstop>
|
||||||
<tabstop>buttonPrecedente</tabstop>
|
|
||||||
<tabstop>buttonSuccessivo</tabstop>
|
|
||||||
<tabstop>buttonModifica</tabstop>
|
|
||||||
</tabstops>
|
</tabstops>
|
||||||
<resources/>
|
<resources/>
|
||||||
<connections/>
|
<connections/>
|
||||||
|
|
Loading…
Reference in New Issue