Print subtest 6 and results
This commit is contained in:
parent
189c24cf61
commit
51271e9595
@ -105,7 +105,6 @@ void DataModel::printTo(QPrinter &printer) const
|
|||||||
QPainter painter;
|
QPainter painter;
|
||||||
painter.begin(&printer);
|
painter.begin(&printer);
|
||||||
|
|
||||||
|
|
||||||
painter.setFont(PrintableModel::h1Font());
|
painter.setFont(PrintableModel::h1Font());
|
||||||
painter.drawText(0, painter.fontMetrics().lineSpacing(), "ESGRAF 4-8 Auswertungsbogen");
|
painter.drawText(0, painter.fontMetrics().lineSpacing(), "ESGRAF 4-8 Auswertungsbogen");
|
||||||
painter.translate(0, 3 * painter.fontMetrics().lineSpacing());
|
painter.translate(0, 3 * painter.fontMetrics().lineSpacing());
|
||||||
@ -132,6 +131,11 @@ void DataModel::printTo(QPrinter &printer) const
|
|||||||
m_dativ.printTo(painter);
|
m_dativ.printTo(painter);
|
||||||
m_plural.printTo(painter);
|
m_plural.printTo(painter);
|
||||||
|
|
||||||
|
m_passiv.printTo(painter);
|
||||||
|
m_genitiv.printTo(painter);
|
||||||
|
|
||||||
|
m_results.printTo(painter);
|
||||||
|
|
||||||
painter.end();
|
painter.end();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,7 +46,7 @@ double PrintableModel::headerWidthFactor()
|
|||||||
|
|
||||||
double PrintableModel::cellWidthFactor()
|
double PrintableModel::cellWidthFactor()
|
||||||
{
|
{
|
||||||
return 0.085;
|
return headerWidthFactor() / 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
void PrintableModel::drawTextSquare(QPainter &painter, const QRectF &cell, const QString &text)
|
void PrintableModel::drawTextSquare(QPainter &painter, const QRectF &cell, const QString &text)
|
||||||
|
@ -33,9 +33,9 @@ public:
|
|||||||
static void drawResultSquare(QPainter &painter, double y, bool rightCell, unsigned int value);
|
static void drawResultSquare(QPainter &painter, double y, bool rightCell, unsigned int value);
|
||||||
static void drawGreySquare(QPainter &painter, const QRectF &cell);
|
static void drawGreySquare(QPainter &painter, const QRectF &cell);
|
||||||
|
|
||||||
protected:
|
|
||||||
static void drawHeader2(QPainter &painter, const QString &text);
|
static void drawHeader2(QPainter &painter, const QString &text);
|
||||||
|
|
||||||
|
protected:
|
||||||
virtual void printHeader(QPainter &painter) const;
|
virtual void printHeader(QPainter &painter) const;
|
||||||
virtual void printTests(QPainter &painter) const;
|
virtual void printTests(QPainter &painter) const;
|
||||||
virtual void printSummary(QPainter &painter) const;
|
virtual void printSummary(QPainter &painter) const;
|
||||||
|
@ -30,6 +30,7 @@ target_include_directories(${PROJECT_NAME}
|
|||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
|
PrintableModel
|
||||||
Age
|
Age
|
||||||
Qt5::Widgets
|
Qt5::Widgets
|
||||||
)
|
)
|
||||||
|
@ -10,13 +10,14 @@
|
|||||||
#include "PassivPR.h"
|
#include "PassivPR.h"
|
||||||
#include "GenitivPR.h"
|
#include "GenitivPR.h"
|
||||||
|
|
||||||
|
#include "PrintableModel.h"
|
||||||
|
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
ResultModel::ResultModel(QObject *parent)
|
ResultModel::ResultModel(QObject *parent)
|
||||||
: QAbstractTableModel(parent)
|
: QAbstractTableModel(parent)
|
||||||
{
|
{
|
||||||
m_results = { { "V2", "SVK", "VE", "Passiv", "Genus", "Akkusativ", "Dativ",
|
m_results = {{"V2", "SVK", "VE", "Passiv", "Genus", "Akkusativ", "Dativ", "Genitiv", "Plural"}};
|
||||||
"Genitiv", "Plural" } };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ResultModel::rowCount(const QModelIndex &parent) const
|
int ResultModel::rowCount(const QModelIndex &parent) const
|
||||||
@ -81,8 +82,7 @@ QVariant ResultModel::data(const QModelIndex &index, int role) const
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant ResultModel::headerData(
|
QVariant ResultModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
int section, Qt::Orientation orientation, int role) const
|
|
||||||
{
|
{
|
||||||
if (role != Qt::DisplayRole)
|
if (role != Qt::DisplayRole)
|
||||||
{
|
{
|
||||||
@ -210,3 +210,49 @@ void ResultModel::setGenitivResult(unsigned int points)
|
|||||||
emit dataChanged(index(0, 7), index(4, 7));
|
emit dataChanged(index(0, 7), index(4, 7));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ResultModel::printTo(QPainter &painter) const
|
||||||
|
{
|
||||||
|
PrintableModel::drawHeader2(painter, "Prozentränge (PR)");
|
||||||
|
|
||||||
|
painter.setFont(PrintableModel::tableFont());
|
||||||
|
painter.setPen(PrintableModel::tablePen());
|
||||||
|
|
||||||
|
auto width = painter.device()->width();
|
||||||
|
auto height = 1.5 * painter.fontMetrics().lineSpacing();
|
||||||
|
|
||||||
|
double cellWidth = width / (m_results.size() + 1);
|
||||||
|
double rowHeight = 2 * height;
|
||||||
|
|
||||||
|
double x = 0;
|
||||||
|
double y = 0;
|
||||||
|
|
||||||
|
PrintableModel::drawTextSquare(painter, {x, y + 0 * rowHeight, cellWidth, rowHeight}, "");
|
||||||
|
PrintableModel::drawTextSquare(painter, {x, y + 1 * rowHeight, cellWidth, rowHeight},
|
||||||
|
"\u2265 PR 84");
|
||||||
|
PrintableModel::drawTextSquare(painter, {x, y + 2 * rowHeight, cellWidth, rowHeight},
|
||||||
|
"< PR 84");
|
||||||
|
|
||||||
|
PrintableModel::drawGreySquare(painter, {x, y + 3 * rowHeight, cellWidth, rowHeight});
|
||||||
|
PrintableModel::drawTextSquare(painter, {x, y + 3 * rowHeight, cellWidth, rowHeight},
|
||||||
|
"\u2264 PR 16");
|
||||||
|
|
||||||
|
x += cellWidth;
|
||||||
|
for (const auto &result : m_results)
|
||||||
|
{
|
||||||
|
PrintableModel::drawTextSquare(painter, {x, y + 0 * rowHeight, cellWidth, rowHeight},
|
||||||
|
result.name());
|
||||||
|
const auto pr = result.pr();
|
||||||
|
|
||||||
|
PrintableModel::drawTextSquare(painter, {x, y + 1 * rowHeight, cellWidth, rowHeight},
|
||||||
|
pr >= 84 ? QString::number(pr) : "-");
|
||||||
|
PrintableModel::drawTextSquare(painter, {x, y + 2 * rowHeight, cellWidth, rowHeight},
|
||||||
|
pr < 84 && pr > 16 ? QString::number(pr) : "-");
|
||||||
|
|
||||||
|
PrintableModel::drawGreySquare(painter, {x, y + 3 * rowHeight, cellWidth, rowHeight});
|
||||||
|
PrintableModel::drawTextSquare(painter, {x, y + 3 * rowHeight, cellWidth, rowHeight},
|
||||||
|
pr <= 16 ? QString::number(pr) : "-");
|
||||||
|
|
||||||
|
x += cellWidth;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -1,7 +1,9 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "Age.h"
|
#include "Age.h"
|
||||||
|
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
|
#include <QPainter>
|
||||||
|
|
||||||
class TestResult
|
class TestResult
|
||||||
{
|
{
|
||||||
@ -72,4 +74,6 @@ public:
|
|||||||
void setSvkResult(unsigned int points);
|
void setSvkResult(unsigned int points);
|
||||||
void setPassivResult(unsigned int points);
|
void setPassivResult(unsigned int points);
|
||||||
void setGenitivResult(unsigned int points);
|
void setGenitivResult(unsigned int points);
|
||||||
|
|
||||||
|
void printTo(QPainter &painter) const;
|
||||||
};
|
};
|
||||||
|
@ -105,3 +105,8 @@ void DativModel::write(ESGRAF48::DativModel &model) const
|
|||||||
nomTiereModel->set_katze(testItems[7].isChecked());
|
nomTiereModel->set_katze(testItems[7].isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DativModel::printHeader(QPainter &painter) const
|
||||||
|
{
|
||||||
|
painter.translate(0, -1.5 * painter.fontMetrics().lineSpacing());
|
||||||
|
}
|
||||||
|
@ -14,5 +14,5 @@ public:
|
|||||||
void write(ESGRAF48::DativModel &model) const;
|
void write(ESGRAF48::DativModel &model) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void printHeader(QPainter &) const override {};
|
void printHeader(QPainter &painter) const override;
|
||||||
};
|
};
|
||||||
|
@ -22,6 +22,7 @@ protobuf_generate_cpp(LateSkills_PROTO_SRCS LateSkills_PROTO_HDRS
|
|||||||
|
|
||||||
add_library(${PROJECT_NAME}
|
add_library(${PROJECT_NAME}
|
||||||
LateSkillsWidget.cpp
|
LateSkillsWidget.cpp
|
||||||
|
LateSkillsModel.cpp
|
||||||
PassivModel.cpp
|
PassivModel.cpp
|
||||||
GenitivModel.cpp
|
GenitivModel.cpp
|
||||||
${UI_HEADERS}
|
${UI_HEADERS}
|
||||||
@ -43,9 +44,7 @@ target_include_directories(${PROJECT_NAME}
|
|||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}
|
target_link_libraries(${PROJECT_NAME}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
CheckableItem
|
PrintableModel
|
||||||
CheckableTest
|
|
||||||
CheckableTestModel
|
|
||||||
Qt5::Widgets
|
Qt5::Widgets
|
||||||
${Protobuf_LIBRARIES}
|
${Protobuf_LIBRARIES}
|
||||||
)
|
)
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#include "GenitivModel.h"
|
#include "GenitivModel.h"
|
||||||
|
|
||||||
GenitivModel::GenitivModel(QObject *parent)
|
GenitivModel::GenitivModel(QObject *parent)
|
||||||
: CheckableTestModel(parent)
|
: LateSkillsModel(parent)
|
||||||
{
|
{
|
||||||
m_tests = {
|
m_tests = {
|
||||||
{"Genitiv Präpositionen",
|
{"Genitiv Präpositionen",
|
||||||
@ -107,3 +107,8 @@ void GenitivModel::write(ESGRAF48::LateSkillsGenitivModel &model) const
|
|||||||
attributierungModel->set_guertel2(testItems[9].isChecked());
|
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
|
#pragma once
|
||||||
|
|
||||||
#include "CheckableTestModel.h"
|
#include "LateSkillsModel.h"
|
||||||
#include "LateSkillsGenitivModel.pb.h"
|
#include "LateSkillsGenitivModel.pb.h"
|
||||||
|
|
||||||
class GenitivModel : public CheckableTestModel
|
class GenitivModel : public LateSkillsModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
@ -14,4 +14,7 @@ public:
|
|||||||
|
|
||||||
void read(const ESGRAF48::LateSkillsGenitivModel &model);
|
void read(const ESGRAF48::LateSkillsGenitivModel &model);
|
||||||
void write(ESGRAF48::LateSkillsGenitivModel &model) const;
|
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"
|
#include "PassivModel.h"
|
||||||
|
|
||||||
PassivModel::PassivModel(QObject *parent)
|
PassivModel::PassivModel(QObject *parent)
|
||||||
: CheckableTestModel(parent)
|
: LateSkillsModel(parent)
|
||||||
{
|
{
|
||||||
m_tests = {{"Passiv",
|
m_tests = {{"Passiv",
|
||||||
{"Elefant (1)", "Elefant (2)", "Pferde (1)", "Pferde (2)", "Bälle (1)", "Bälle (2)",
|
{"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_fleisch1(testItems[8].isChecked());
|
||||||
model.set_fleisch2(testItems[9].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
|
#pragma once
|
||||||
|
|
||||||
#include "CheckableTestModel.h"
|
#include "LateSkillsModel.h"
|
||||||
#include "LateSkillsPassivModel.pb.h"
|
#include "LateSkillsPassivModel.pb.h"
|
||||||
|
|
||||||
class PassivModel : public CheckableTestModel
|
class PassivModel : public LateSkillsModel
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
PassivModel(QObject *parent);
|
PassivModel(QObject *parent);
|
||||||
bool setData(const QModelIndex &index, const QVariant &value,
|
bool setData(const QModelIndex &index, const QVariant &value, int role = Qt::EditRole) override;
|
||||||
int role = Qt::EditRole) override;
|
|
||||||
|
|
||||||
void read(const ESGRAF48::LateSkillsPassivModel &model);
|
void read(const ESGRAF48::LateSkillsPassivModel &model);
|
||||||
void write(ESGRAF48::LateSkillsPassivModel &model) const;
|
void write(ESGRAF48::LateSkillsPassivModel &model) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void printHeader(QPainter &painter) const override;
|
||||||
};
|
};
|
||||||
|
@ -76,10 +76,7 @@ void PluralModel::printTests(QPainter &painter) const
|
|||||||
|
|
||||||
x += cellWidth;
|
x += cellWidth;
|
||||||
}
|
}
|
||||||
y += rowHeight;
|
y += 2 * rowHeight;
|
||||||
|
|
||||||
drawResultSquare(painter, y, true, test.getPoints());
|
|
||||||
y += rowHeight;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
painter.translate(0, y + 2 * rowHeight);
|
painter.translate(0, y + 2 * rowHeight);
|
||||||
|
Reference in New Issue
Block a user