Print subtest 6 and results
This commit is contained in:
parent
189c24cf61
commit
51271e9595
16 changed files with 187 additions and 37 deletions
|
@ -22,6 +22,7 @@ protobuf_generate_cpp(LateSkills_PROTO_SRCS LateSkills_PROTO_HDRS
|
|||
|
||||
add_library(${PROJECT_NAME}
|
||||
LateSkillsWidget.cpp
|
||||
LateSkillsModel.cpp
|
||||
PassivModel.cpp
|
||||
GenitivModel.cpp
|
||||
${UI_HEADERS}
|
||||
|
@ -43,9 +44,7 @@ target_include_directories(${PROJECT_NAME}
|
|||
|
||||
target_link_libraries(${PROJECT_NAME}
|
||||
PRIVATE
|
||||
CheckableItem
|
||||
CheckableTest
|
||||
CheckableTestModel
|
||||
PrintableModel
|
||||
Qt5::Widgets
|
||||
${Protobuf_LIBRARIES}
|
||||
)
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
#include "GenitivModel.h"
|
||||
|
||||
GenitivModel::GenitivModel(QObject *parent)
|
||||
: CheckableTestModel(parent)
|
||||
: LateSkillsModel(parent)
|
||||
{
|
||||
m_tests = {
|
||||
{"Genitiv Präpositionen",
|
||||
|
@ -107,3 +107,8 @@ void GenitivModel::write(ESGRAF48::LateSkillsGenitivModel &model) const
|
|||
attributierungModel->set_guertel2(testItems[9].isChecked());
|
||||
}
|
||||
}
|
||||
|
||||
void GenitivModel::printHeader(QPainter &painter) const
|
||||
{
|
||||
painter.translate(0, -1.5 * painter.fontMetrics().lineSpacing());
|
||||
}
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
#pragma once
|
||||
|
||||
#include "CheckableTestModel.h"
|
||||
#include "LateSkillsModel.h"
|
||||
#include "LateSkillsGenitivModel.pb.h"
|
||||
|
||||
class GenitivModel : public CheckableTestModel
|
||||
class GenitivModel : public LateSkillsModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
|
@ -14,4 +14,7 @@ public:
|
|||
|
||||
void read(const ESGRAF48::LateSkillsGenitivModel &model);
|
||||
void write(ESGRAF48::LateSkillsGenitivModel &model) const;
|
||||
|
||||
protected:
|
||||
void printHeader(QPainter &painter) const override;
|
||||
};
|
||||
|
|
64
source/SubTests/LateSkills/LateSkillsModel.cpp
Normal file
64
source/SubTests/LateSkills/LateSkillsModel.cpp
Normal file
|
@ -0,0 +1,64 @@
|
|||
#include "LateSkillsModel.h"
|
||||
|
||||
#include <regex>
|
||||
|
||||
LateSkillsModel::LateSkillsModel(QObject *parent)
|
||||
: PrintableModel(parent)
|
||||
{
|
||||
}
|
||||
|
||||
void LateSkillsModel::printTests(QPainter &painter) const
|
||||
{
|
||||
painter.setFont(tableFont());
|
||||
painter.setPen(tablePen());
|
||||
|
||||
auto width = painter.device()->width();
|
||||
auto height = 1.5 * painter.fontMetrics().lineSpacing();
|
||||
|
||||
double headerWidth = headerWidthFactor() * width;
|
||||
double cellHeaderWidth = cellWidthFactor() * width;
|
||||
double cellWidth = 0.5 * cellHeaderWidth;
|
||||
double rowHeight = height;
|
||||
|
||||
double x = 0;
|
||||
double y = 0;
|
||||
for (const auto &test : m_tests)
|
||||
{
|
||||
QString testName = QString::fromStdString(
|
||||
std::regex_replace(test.name().toStdString(), std::regex("\\s"), "\n"));
|
||||
|
||||
drawTextSquare(painter, {0, y, headerWidth, 3 * rowHeight}, testName);
|
||||
|
||||
const auto &items = test.items();
|
||||
|
||||
x = headerWidth;
|
||||
for (unsigned int i = 0; i < items.size(); i += 2)
|
||||
{
|
||||
const auto &item = test.items().at(i);
|
||||
QString itemText = QString::fromStdString(item.getText()).split(" ").at(0);
|
||||
|
||||
drawTextSquare(painter, {x, y, cellHeaderWidth, rowHeight}, itemText);
|
||||
|
||||
x += cellHeaderWidth;
|
||||
}
|
||||
y += rowHeight;
|
||||
|
||||
x = headerWidth;
|
||||
for (const auto &item : items)
|
||||
{
|
||||
drawTextSquare(painter, {x, y, cellWidth, rowHeight}, QString::number(item.value()));
|
||||
drawCheckSquare(painter, {x, y + rowHeight, cellWidth, rowHeight}, item.isChecked());
|
||||
|
||||
x += cellWidth;
|
||||
}
|
||||
|
||||
if (m_tests.size() > 1)
|
||||
{
|
||||
drawResultSquare(painter, y + rowHeight, true, test.getPoints());
|
||||
}
|
||||
|
||||
y += 2 * rowHeight;
|
||||
}
|
||||
|
||||
painter.translate(0, y + rowHeight);
|
||||
}
|
15
source/SubTests/LateSkills/LateSkillsModel.h
Normal file
15
source/SubTests/LateSkills/LateSkillsModel.h
Normal file
|
@ -0,0 +1,15 @@
|
|||
#pragma once
|
||||
|
||||
#include "PrintableModel.h"
|
||||
#include "LateSkillsPassivModel.pb.h"
|
||||
|
||||
class LateSkillsModel : public PrintableModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
LateSkillsModel(QObject *parent);
|
||||
|
||||
protected:
|
||||
void printTests(QPainter &painter) const override;
|
||||
};
|
|
@ -1,7 +1,7 @@
|
|||
#include "PassivModel.h"
|
||||
|
||||
PassivModel::PassivModel(QObject *parent)
|
||||
: CheckableTestModel(parent)
|
||||
: LateSkillsModel(parent)
|
||||
{
|
||||
m_tests = {{"Passiv",
|
||||
{"Elefant (1)", "Elefant (2)", "Pferde (1)", "Pferde (2)", "Bälle (1)", "Bälle (2)",
|
||||
|
@ -65,3 +65,8 @@ void PassivModel::write(ESGRAF48::LateSkillsPassivModel &model) const
|
|||
model.set_fleisch1(testItems[8].isChecked());
|
||||
model.set_fleisch2(testItems[9].isChecked());
|
||||
}
|
||||
|
||||
void PassivModel::printHeader(QPainter &painter) const
|
||||
{
|
||||
drawHeader2(painter, "Subtest 6: Späte Fähigkeiten (7;0-8;11)");
|
||||
}
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
#pragma once
|
||||
|
||||
#include "CheckableTestModel.h"
|
||||
#include "LateSkillsModel.h"
|
||||
#include "LateSkillsPassivModel.pb.h"
|
||||
|
||||
class PassivModel : public CheckableTestModel
|
||||
class PassivModel : public LateSkillsModel
|
||||
{
|
||||
Q_OBJECT
|
||||
|
||||
public:
|
||||
PassivModel(QObject *parent);
|
||||
bool setData(const QModelIndex &index, const QVariant &value,
|
||||
int role = Qt::EditRole) override;
|
||||
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||
|
||||
void read(const ESGRAF48::LateSkillsPassivModel &model);
|
||||
void write(ESGRAF48::LateSkillsPassivModel &model) const;
|
||||
|
||||
protected:
|
||||
void printHeader(QPainter &painter) const override;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue