gestionale/mainwindow.cpp

34 lines
829 B
C++
Raw Normal View History

2019-08-03 15:24:44 +00:00
#include "mainwindow.h"
MainWindow::MainWindow(QWidget *parent) :
QMainWindow(parent),
ui(new Ui::MainWindow)
{
ui->setupUi(this);
populateUi();
}
bool MainWindow::populateUi(void) {
QComboBox* comboProfessione = this->findChild<QComboBox*>("comboProfessione");
2019-08-03 15:48:30 +00:00
QSqlQuery query;
2019-08-03 15:24:44 +00:00
2019-08-03 15:48:30 +00:00
query = QSqlQuery("SELECT id, professione FROM professione");
2019-08-03 15:24:44 +00:00
while (query.next()) {
comboProfessione->addItem(query.value(1).toString().toUtf8().data(), query.value(0).toInt());
}
2019-08-03 15:48:30 +00:00
QComboBox* comboFonte = this->findChild<QComboBox*>("comboFonte");
query = QSqlQuery("SELECT id, fonte FROM fonte");
while (query.next()) {
comboFonte->addItem(query.value(1).toString().toUtf8().data(), query.value(0).toInt());
}
2019-08-03 15:24:44 +00:00
return true;
}
MainWindow::~MainWindow()
{
delete ui;
}