|
|
|
#include "accommodationform.h"
|
|
|
|
#include "ui_accommodationform.h"
|
|
|
|
|
|
|
|
#include <core.h>
|
|
|
|
#include <autotablemodel.h>
|
|
|
|
|
|
|
|
#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<Person> service;
|
|
|
|
TableModel *model = qobject_cast<TableModel*>(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();
|
|
|
|
}
|