#include "accommodationform.h" #include "ui_accommodationform.h" #include #include #include "dialog.h" #include "data/person.h" #include "tablemodel.h" #include "accommodation-odb.hxx" AccommodationForm::AccommodationForm(QWidget *parent) : QWidget(parent), ui(new Ui::AccommodationForm) { ui->setupUi(this); } AccommodationForm::~AccommodationForm() { delete ui; } void AccommodationForm::fillGrid() { Service service; TableModel *model = qobject_cast(ui->tableView->model()); if (model == NULL) { model = new TableModel(); } model->setData(service.all()); ui->tableView->setModel(model); } void AccommodationForm::on_pushButton_clicked() { Dialog *d = new Dialog(); if (ui->tableView->model()->rowCount() > 0) { d->setData(((TableModel*)ui->tableView->model())->itemFromIndex(ui->tableView->currentIndex())); } d->open(); }