diff --git a/source/DataModel.cpp b/source/DataModel.cpp index 4bd4df9..5ac55f8 100644 --- a/source/DataModel.cpp +++ b/source/DataModel.cpp @@ -70,7 +70,7 @@ void DataModel::printTo(QTextCursor &cursor) const m_metaData.printTo(cursor); - //m_v2Svk.printTo(cursor); + m_v2Svk.printTo(cursor); m_verbEnd.printTo(cursor); m_genus.printTo(cursor); m_akkusativ.printTo(cursor); diff --git a/source/SubTests/V2Svk/V2SvkModel.cpp b/source/SubTests/V2Svk/V2SvkModel.cpp index 755eacd..8e8c812 100644 --- a/source/SubTests/V2Svk/V2SvkModel.cpp +++ b/source/SubTests/V2Svk/V2SvkModel.cpp @@ -1,5 +1,7 @@ #include "V2SvkModel.h" +#include + V2SvkModel::V2SvkModel(QObject *parent) : CheckableTestModel(parent) { @@ -204,3 +206,61 @@ std::string V2SvkModel::getName() const { return "Subtest 1: Verbzweitstellungsregel (V2) und Subjekt-Verb-Kontrollregel (SVK)"; } + +void V2SvkModel::printTableTo(QTextCursor &cursor) const +{ + QTextTableFormat tableFormat; + tableFormat.setCellPadding(2); + tableFormat.setCellSpacing(0); + + tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::PercentageLength, 20), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 5), + QTextLength(QTextLength::PercentageLength, 13), + QTextLength(QTextLength::PercentageLength, 3), + QTextLength(QTextLength::PercentageLength, 1), + QTextLength(QTextLength::PercentageLength, 3)}); + + QTextTable *table = cursor.insertTable(2, 17, tableFormat); + + int currentRow = 0; + int currentTest = 0; + //for (const auto &test : m_tests) + { + table->mergeCells(currentRow, 0, 2, 1); + + int currentColumn = 0; + + setCellText(*table, currentRow, currentColumn, m_tests[0].name()); + currentColumn++; + + for (auto it = std::begin(m_tests[0].items()); it != std::end(m_tests[0].items()); std::advance(it, 4)) + { + table->mergeCells(currentRow, currentColumn, 1, 4); + + auto itemName = it->getText(); + + setCellText(*table, currentRow, currentColumn, itemName.c_str()); + setCellChecked(*table, currentRow + 1, currentColumn, it->isChecked()); + setCellChecked(*table, currentRow + 1, currentColumn + 1, (it + 1)->isChecked()); + setCellChecked(*table, currentRow + 1, currentColumn + 2, (it + 2)->isChecked()); + setCellChecked(*table, currentRow + 1, currentColumn + 3, (it + 3)->isChecked()); + + currentColumn += 4; + } + + setCellNumber(*table, currentRow + 1, 14, m_tests[0].getPoints()); + + currentRow += 2; + } +} diff --git a/source/SubTests/V2Svk/V2SvkModel.h b/source/SubTests/V2Svk/V2SvkModel.h index ec54a81..4e524a0 100644 --- a/source/SubTests/V2Svk/V2SvkModel.h +++ b/source/SubTests/V2Svk/V2SvkModel.h @@ -22,4 +22,5 @@ protected: bool isValidIndex(const QModelIndex &index) const override; std::string getName() const override; + void printTableTo(QTextCursor &cursor) const override; };