#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("comboProfessione"); QSqlQuery query; query = QSqlQuery("SELECT id, professione FROM professione"); while (query.next()) { comboProfessione->addItem(query.value(1).toString().toUtf8().data(), query.value(0).toInt()); } QComboBox* comboFonte = this->findChild("comboFonte"); query = QSqlQuery("SELECT id, fonte FROM fonte"); while (query.next()) { comboFonte->addItem(query.value(1).toString().toUtf8().data(), query.value(0).toInt()); } return true; } MainWindow::~MainWindow() { delete ui; }