ESGRAF48/source/MetaData/MetaDataWidget.cpp

43 lines
1.1 KiB
C++
Raw Normal View History

2018-05-17 18:04:42 +00:00
#include "MetaDataWidget.h"
#include "ui_MetaDataWidget.h"
2018-05-18 17:51:48 +00:00
#include "MetaDataModel.h"
#include <QDataWidgetMapper>
2018-07-17 18:33:38 +00:00
#include <QDebug>
2018-05-18 17:51:48 +00:00
2018-05-17 18:04:42 +00:00
MetaDataWidget::MetaDataWidget(QWidget *parent)
2018-05-18 17:51:48 +00:00
: QWidget(parent)
, ui(new Ui::MetaDataWidget)
, m_widgetMapper(new QDataWidgetMapper(this))
2018-05-17 18:04:42 +00:00
{
ui->setupUi(this);
2018-07-17 18:33:38 +00:00
connect(ui->dateOfTestDateEdit, &QDateEdit::dateChanged, m_widgetMapper,
&QDataWidgetMapper::submit);
connect(ui->dateOfBirthDateEdit, &QDateEdit::dateChanged, m_widgetMapper,
&QDataWidgetMapper::submit);
2018-05-17 18:04:42 +00:00
}
MetaDataWidget::~MetaDataWidget()
{
delete ui;
}
2018-05-18 17:51:48 +00:00
void MetaDataWidget::setModel(MetaDataModel *model)
{
m_widgetMapper->setModel(model);
m_widgetMapper->addMapping(ui->participantLineEdit, 0);
m_widgetMapper->addMapping(ui->instructorLineEdit, 1);
m_widgetMapper->addMapping(ui->dateOfBirthDateEdit, 2);
m_widgetMapper->addMapping(ui->dateOfTestDateEdit, 3);
m_widgetMapper->addMapping(ui->remarksPlainTextEdit, 4);
2018-06-14 17:52:19 +00:00
m_widgetMapper->addMapping(ui->ageLineEdit, 5);
2018-05-18 17:51:48 +00:00
m_widgetMapper->toFirst();
}
void MetaDataWidget::toFirst()
{
m_widgetMapper->toFirst();
}