Added fat lines around summary squares
This commit is contained in:
parent
ab862aeaf1
commit
1695174303
@ -32,6 +32,11 @@ QPen PrintableModel::tablePen()
|
||||
return QPen(Qt::black, 1, Qt::SolidLine);
|
||||
}
|
||||
|
||||
QPen PrintableModel::resultPen()
|
||||
{
|
||||
return QPen(Qt::black, 2, Qt::SolidLine);
|
||||
}
|
||||
|
||||
void PrintableModel::drawTextSquare(QPainter &painter, const QRectF &cell, const QString &text)
|
||||
{
|
||||
auto prevPen = painter.pen();
|
||||
@ -47,6 +52,19 @@ void PrintableModel::drawTextSquare(QPainter &painter, const QRectF &cell, const
|
||||
painter.setPen(prevPen);
|
||||
}
|
||||
|
||||
void PrintableModel::drawNumberSquare(QPainter &painter, double x, double y, int number)
|
||||
{
|
||||
QRectF cell = {x, y, 0.03 * painter.device()->width(),
|
||||
1.5 * painter.fontMetrics().lineSpacing()};
|
||||
|
||||
painter.drawText(cell, Qt::AlignCenter, QString::number(number));
|
||||
|
||||
painter.drawLine(cell.topLeft(), cell.topRight());
|
||||
painter.drawLine(cell.topRight(), cell.bottomRight());
|
||||
painter.drawLine(cell.bottomRight(), cell.bottomLeft());
|
||||
painter.drawLine(cell.bottomLeft(), cell.topLeft());
|
||||
}
|
||||
|
||||
void PrintableModel::PrintableModel::drawCheckSquare(QPainter &painter, const QRectF &cell,
|
||||
bool checked)
|
||||
{
|
||||
@ -138,14 +156,14 @@ void PrintableModel::printTests(QPainter &painter) const
|
||||
void PrintableModel::printSummary(QPainter &painter) const
|
||||
{
|
||||
painter.setFont(tableFont());
|
||||
painter.setPen(tablePen());
|
||||
|
||||
auto width = painter.device()->width();
|
||||
auto height = 1.5 * painter.fontMetrics().lineSpacing();
|
||||
|
||||
painter.drawText(0, 0, 0.85 * width, height, Qt::AlignRight | Qt::AlignVCenter,
|
||||
painter.drawText(0, 0, 0.95 * width, height, Qt::AlignRight | Qt::AlignVCenter,
|
||||
"Rohwertpunkte Total:");
|
||||
drawResultSquare(painter, 0, true, getPoints());
|
||||
painter.setPen(resultPen());
|
||||
drawNumberSquare(painter, 0.97 * width, 0, getPoints());
|
||||
|
||||
painter.translate(0, 3 * height);
|
||||
}
|
||||
|
@ -22,8 +22,10 @@ public:
|
||||
static QFont tableFont();
|
||||
|
||||
static QPen tablePen();
|
||||
static QPen resultPen();
|
||||
|
||||
static void drawTextSquare(QPainter &painter, const QRectF &cell, const QString &text);
|
||||
static void drawNumberSquare(QPainter &painter, double x, double y, int number);
|
||||
static void drawCheckSquare(QPainter &painter, const QRectF &cell, bool checked);
|
||||
static void drawResultSquare(QPainter &painter, double y, bool rightCell, unsigned int value);
|
||||
static void drawGreySquare(QPainter &painter, const QRectF &cell);
|
||||
|
@ -116,10 +116,12 @@ void V2SvkModel::printSummary(QPainter &painter, unsigned int v2Points, unsigned
|
||||
auto width = painter.device()->width();
|
||||
auto height = 1.5 * painter.fontMetrics().lineSpacing();
|
||||
|
||||
painter.drawText(0, 0, 0.85 * width, height, Qt::AlignRight | Qt::AlignVCenter,
|
||||
painter.drawText(0, 0, 0.91 * width, height, Qt::AlignRight | Qt::AlignVCenter,
|
||||
"Rohwertpunkte Total:");
|
||||
PrintableModel::drawResultSquare(painter, 0, false, v2Points);
|
||||
PrintableModel::drawResultSquare(painter, 0, true, svkPoints);
|
||||
|
||||
painter.setPen(resultPen());
|
||||
drawNumberSquare(painter, 0.93 * width, 0, v2Points);
|
||||
drawNumberSquare(painter, 0.97 * width, 0, svkPoints);
|
||||
|
||||
painter.translate(0, 3 * height);
|
||||
}
|
||||
|
@ -5,13 +5,10 @@ VerbEndModel::VerbEndModel(QObject *parent)
|
||||
{
|
||||
m_title = "Subtest 2: Verbendstellungsregel (VE)";
|
||||
|
||||
m_tests = { { "Telefonat",
|
||||
{ "Kausal", "Kausal", "Relativ", "Kausal",
|
||||
"Final", "Temporal", "Temporal" } },
|
||||
{ "Zaubertrick", { "Relativ", "Final", "Kausal", "Final",
|
||||
"Temporal", "Kausal", "Temporal" } },
|
||||
{ "Zauberregel", { "Temporal", "Kausal", "Final", "Relativ",
|
||||
"Temporal", "Relativ" } } };
|
||||
m_tests = {
|
||||
{"Telefonat", {"Kausal", "Kausal", "Relativ", "Kausal", "Final", "Temporal", "Temporal"}},
|
||||
{"Zaubertrick", {"Relativ", "Final", "Kausal", "Final", "Temporal", "Kausal", "Temporal"}},
|
||||
{"Zauberregel", {"Temporal", "Kausal", "Final", "Relativ", "Temporal", "Relativ"}}};
|
||||
}
|
||||
|
||||
void VerbEndModel::write(ESGRAF48::VerbEndModel &model) const
|
||||
@ -101,3 +98,31 @@ void VerbEndModel::read(const ESGRAF48::VerbEndModel &model)
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
unsigned int VerbEndModel::getKausalPoints() const
|
||||
{
|
||||
auto points = [&](unsigned int testId, unsigned int itemId) {
|
||||
return m_tests.at(testId).items().at(itemId).points();
|
||||
};
|
||||
|
||||
return points(0, 0) + points(0, 1) + points(0, 3) + points(1, 2) + points(1, 5) + points(2, 1);
|
||||
}
|
||||
|
||||
void VerbEndModel::printSummary(QPainter &painter) const
|
||||
{
|
||||
painter.setFont(tableFont());
|
||||
|
||||
auto width = painter.device()->width();
|
||||
auto height = 1.5 * painter.fontMetrics().lineSpacing();
|
||||
|
||||
painter.drawText(0, 0, 0.71 * width, height, Qt::AlignRight | Qt::AlignVCenter,
|
||||
"Rohwertpunkte Kausalsätze:");
|
||||
painter.drawText(0, 0, 0.95 * width, height, Qt::AlignRight | Qt::AlignVCenter,
|
||||
"Rohwertpunkte Total:");
|
||||
|
||||
drawNumberSquare(painter, 0.73 * width, 0, getKausalPoints());
|
||||
|
||||
painter.setPen(resultPen());
|
||||
drawNumberSquare(painter, 0.97 * width, 0, getKausalPoints());
|
||||
|
||||
painter.translate(0, 3 * height);
|
||||
}
|
||||
|
@ -12,4 +12,9 @@ public:
|
||||
|
||||
void write(ESGRAF48::VerbEndModel &model) const;
|
||||
void read(const ESGRAF48::VerbEndModel &model);
|
||||
|
||||
unsigned int getKausalPoints() const;
|
||||
|
||||
protected:
|
||||
void printSummary(QPainter &painter) const override;
|
||||
};
|
||||
|
Reference in New Issue
Block a user