You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
prodejna/accommodation/accommodationform.cpp

48 lines
961 B
C++

#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();
}