ESGRAF48/source/MetaData/MetaDataWidget.cpp

43 lines
1.1 KiB
C++
Raw Permalink 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
2019-10-05 14:14:45 +00:00
MetaDataWidget::MetaDataWidget(QWidget* parent)
: QWidget(parent)
, ui(new Ui::MetaDataWidget)
, m_widgetMapper(new QDataWidgetMapper(this))
2018-05-17 18:04:42 +00:00
{
2019-10-05 14:14:45 +00:00
ui->setupUi(this);
2018-07-17 18:33:38 +00:00
2019-10-05 14:14:45 +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()
{
2019-10-05 14:14:45 +00:00
delete ui;
2018-05-17 18:04:42 +00:00
}
2019-10-05 14:14:45 +00:00
void MetaDataWidget::setModel(MetaDataModel* model)
2018-05-18 17:51:48 +00:00
{
2019-10-05 14:14:45 +00:00
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);
m_widgetMapper->addMapping(ui->ageLineEdit, 5);
m_widgetMapper->toFirst();
2018-05-18 17:51:48 +00:00
}
void MetaDataWidget::toFirst()
{
2019-10-05 14:14:45 +00:00
m_widgetMapper->toFirst();
2018-05-18 17:51:48 +00:00
}