2018-06-26 14:59:51 +00:00
|
|
|
#include "PassivModel.h"
|
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
PassivModel::PassivModel(QObject* parent)
|
2019-02-07 21:36:39 +00:00
|
|
|
: LateSkillsModel(parent)
|
2018-06-26 14:59:51 +00:00
|
|
|
{
|
2019-10-05 14:14:45 +00:00
|
|
|
m_tests = {{"Passiv",
|
|
|
|
{"Elefant (1)", "Elefant (2)", "Pferde (1)", "Pferde (2)", "Bälle (1)", "Bälle (2)",
|
|
|
|
"Ball (1)", "Ball (2)", "Fleisch (1)", "Fleisch (2)"}}};
|
2018-06-29 17:31:28 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
for (auto index : {1, 3, 5, 7, 9})
|
|
|
|
{
|
|
|
|
m_tests[0].items()[index].setValue(2);
|
|
|
|
}
|
2018-06-29 17:31:28 +00:00
|
|
|
}
|
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
bool PassivModel::setData(const QModelIndex& modelIndex, const QVariant& value, int role)
|
2018-06-29 17:31:28 +00:00
|
|
|
{
|
2019-10-05 14:14:45 +00:00
|
|
|
if (role == Qt::CheckStateRole && value.toBool() == true)
|
|
|
|
{
|
|
|
|
if (modelIndex.column() % 2 == 0)
|
|
|
|
{
|
|
|
|
CheckableTestModel::setData(index(modelIndex.row(), modelIndex.column() + 1), false,
|
|
|
|
role);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
CheckableTestModel::setData(index(modelIndex.row(), modelIndex.column() - 1), false,
|
|
|
|
role);
|
|
|
|
}
|
|
|
|
}
|
2018-06-29 17:31:28 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
return CheckableTestModel::setData(modelIndex, value, role);
|
2018-06-26 14:59:51 +00:00
|
|
|
}
|
2018-11-18 20:29:43 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
void PassivModel::read(const ESGRAF48::LateSkillsPassivModel& model)
|
2018-11-18 20:29:43 +00:00
|
|
|
{
|
2019-10-05 14:14:45 +00:00
|
|
|
auto& testItems = m_tests.at(0).items();
|
2018-11-18 20:29:43 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
testItems[0].setState(model.elefant1());
|
|
|
|
testItems[1].setState(model.elefant2());
|
|
|
|
testItems[2].setState(model.pferde1());
|
|
|
|
testItems[3].setState(model.pferde2());
|
|
|
|
testItems[4].setState(model.baelle1());
|
|
|
|
testItems[5].setState(model.baelle2());
|
|
|
|
testItems[6].setState(model.ball1());
|
|
|
|
testItems[7].setState(model.ball2());
|
|
|
|
testItems[8].setState(model.fleisch1());
|
|
|
|
testItems[9].setState(model.fleisch2());
|
2018-11-18 20:29:43 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
2018-11-18 20:29:43 +00:00
|
|
|
}
|
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
void PassivModel::write(ESGRAF48::LateSkillsPassivModel& model) const
|
2018-11-18 20:29:43 +00:00
|
|
|
{
|
2019-10-05 14:14:45 +00:00
|
|
|
const auto& testItems = m_tests.at(0).items();
|
2018-11-18 20:29:43 +00:00
|
|
|
|
2019-10-05 14:14:45 +00:00
|
|
|
model.set_elefant1(testItems[0].isChecked());
|
|
|
|
model.set_elefant2(testItems[1].isChecked());
|
|
|
|
model.set_pferde1(testItems[2].isChecked());
|
|
|
|
model.set_pferde2(testItems[3].isChecked());
|
|
|
|
model.set_baelle1(testItems[4].isChecked());
|
|
|
|
model.set_baelle2(testItems[5].isChecked());
|
|
|
|
model.set_ball1(testItems[6].isChecked());
|
|
|
|
model.set_ball2(testItems[7].isChecked());
|
|
|
|
model.set_fleisch1(testItems[8].isChecked());
|
|
|
|
model.set_fleisch2(testItems[9].isChecked());
|
2018-11-18 20:29:43 +00:00
|
|
|
}
|
2019-10-05 14:14:45 +00:00
|
|
|
|
|
|
|
void PassivModel::printHeader(QPainter& painter) const
|
2019-02-07 21:36:39 +00:00
|
|
|
{
|
2019-10-05 14:14:45 +00:00
|
|
|
drawHeader2(painter, "Subtest 6: Späte Fähigkeiten (7;0-8;11)");
|
2019-02-07 21:36:39 +00:00
|
|
|
}
|