#include "detailwidget.h" #include "ui_detailwidget.h" #include "campservice.h" DetailWidget::DetailWidget(QWidget *parent) : QWidget(parent), ui(new Ui::DetailWidget) { ui->setupUi(this); m_peopleModel = new AutoTableModel(this); m_servicesModel = new AutoTableModel(this); ui->tabPeople->setModel(m_peopleModel); ui->tabServices->setModel(m_servicesModel); ui->tabPeople->hideColumn(0); ui->tabPeople->hideColumn(1); ui->tabPeople->hideColumn(6); ui->tabPeople->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch); ui->tabServices->hideColumn(1); ui->tabServices->hideColumn(3); ui->tabServices->hideColumn(7); ui->tabServices->horizontalHeader()->setSectionResizeMode(0, QHeaderView::Stretch); ui->tabServices->horizontalHeader()->setSectionResizeMode(2, QHeaderView::Stretch); } DetailWidget::~DetailWidget() { delete ui; } void DetailWidget::setData(const CampDataPtr &data) { CampService srv; srv.loadItems(data); m_peopleModel->setData(data->people()); m_servicesModel->setData(data->services()); }