From 49b52f1dbc0d17bedb8e1c77ea8b53687e284fd9 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sat, 8 Dec 2018 21:02:35 +0100 Subject: [PATCH] Print subtests 2, 3 and 4 --- source/CheckableTestModel/CMakeLists.txt | 2 + .../CheckableTestModel/CheckableTestModel.cpp | 165 +++++++++++++++--- .../CheckableTestModel/CheckableTestModel.h | 7 + source/DataModel.cpp | 15 +- source/MetaData/MetaDataModel.cpp | 8 +- .../AkkusativDativ/AkkusativModel.cpp | 5 + .../SubTests/AkkusativDativ/AkkusativModel.h | 3 + source/SubTests/AkkusativDativ/DativModel.cpp | 5 + source/SubTests/AkkusativDativ/DativModel.h | 3 + source/SubTests/Genus/GenusModel.cpp | 5 + source/SubTests/Genus/GenusModel.h | 3 + source/SubTests/LateSkills/GenitivModel.cpp | 5 + source/SubTests/LateSkills/GenitivModel.h | 3 + source/SubTests/LateSkills/PassivModel.cpp | 5 + source/SubTests/LateSkills/PassivModel.h | 3 + source/SubTests/Plural/PluralModel.cpp | 5 + source/SubTests/Plural/PluralModel.h | 3 + source/SubTests/V2Svk/V2SvkModel.cpp | 19 +- source/SubTests/V2Svk/V2SvkModel.h | 4 +- source/SubTests/VerbEnd/VerbEndModel.cpp | 153 +--------------- source/SubTests/VerbEnd/VerbEndModel.h | 3 +- 21 files changed, 223 insertions(+), 201 deletions(-) diff --git a/source/CheckableTestModel/CMakeLists.txt b/source/CheckableTestModel/CMakeLists.txt index 2ce7c3b..a9400cf 100644 --- a/source/CheckableTestModel/CMakeLists.txt +++ b/source/CheckableTestModel/CMakeLists.txt @@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.6) project(CheckableTestModel LANGUAGES CXX) find_package(Qt5Core REQUIRED) +find_package(Qt5Gui REQUIRED) add_library(${PROJECT_NAME} CheckableTestModel.cpp @@ -22,4 +23,5 @@ target_link_libraries(${PROJECT_NAME} CheckableItem CheckableTest Qt5::Core + Qt5::Gui ) diff --git a/source/CheckableTestModel/CheckableTestModel.cpp b/source/CheckableTestModel/CheckableTestModel.cpp index c0a60a1..5530173 100644 --- a/source/CheckableTestModel/CheckableTestModel.cpp +++ b/source/CheckableTestModel/CheckableTestModel.cpp @@ -2,16 +2,17 @@ #include #include +#include #include CheckableTestModel::CheckableTestModel(QObject *parent) - : QAbstractTableModel(parent) + : QAbstractTableModel(parent) { } int CheckableTestModel::rowCount(const QModelIndex &) const { - return static_cast(m_tests.size()); + return static_cast(m_tests.size()); } int CheckableTestModel::columnCount(const QModelIndex &) const @@ -20,7 +21,7 @@ int CheckableTestModel::columnCount(const QModelIndex &) const for (const auto &test : m_tests) { - columnCount = std::max(columnCount, static_cast(test.size())); + columnCount = std::max(columnCount, static_cast(test.size())); } return columnCount; @@ -37,17 +38,17 @@ QVariant CheckableTestModel::data(const QModelIndex &index, int role) const { auto &item = getItem(index); - switch (role) - { - case Qt::DisplayRole: - { - return item.getText().c_str(); - } - case Qt::CheckStateRole: - { - return item.isChecked() ? Qt::Checked : Qt::Unchecked; - } - } + switch (role) + { + case Qt::DisplayRole: + { + return item.getText().c_str(); + } + case Qt::CheckStateRole: + { + return item.isChecked() ? Qt::Checked : Qt::Unchecked; + } + } } catch (std::runtime_error &e) { @@ -67,8 +68,7 @@ Qt::ItemFlags CheckableTestModel::flags(const QModelIndex &index) const return Qt::NoItemFlags; } -bool CheckableTestModel::setData( - const QModelIndex &index, const QVariant &value, int role) +bool CheckableTestModel::setData(const QModelIndex &index, const QVariant &value, int role) { if (!isValidIndex(index)) { @@ -93,8 +93,7 @@ bool CheckableTestModel::setData( return false; } -QVariant CheckableTestModel::headerData( - int section, Qt::Orientation orientation, int role) const +QVariant CheckableTestModel::headerData(int section, Qt::Orientation orientation, int role) const { if (role == Qt::DisplayRole && orientation == Qt::Vertical) { @@ -104,7 +103,7 @@ QVariant CheckableTestModel::headerData( } } - return QAbstractTableModel::headerData(section, orientation, role); + return QAbstractTableModel::headerData(section, orientation, role); } bool CheckableTestModel::isValidIndex(const QModelIndex &index) const @@ -117,6 +116,129 @@ bool CheckableTestModel::isValidIndex(const QModelIndex &index) const return false; } +void CheckableTestModel::printTo(QTextCursor &cursor) const +{ + QTextCharFormat headerFormat; + headerFormat.setFontPointSize(10); + cursor.insertBlock(); + cursor.insertText("\n"); + cursor.insertText(getName().c_str(), headerFormat); + + printTableTo(cursor); + cursor.movePosition(QTextCursor::End); + cursor.insertBlock(); + cursor.insertText("\n"); + printSummaryTo(cursor); + cursor.movePosition(QTextCursor::End); +} + +void CheckableTestModel::printTableTo(QTextCursor &cursor) const +{ + QTextTableFormat tableFormat; + tableFormat.setCellPadding(2); + tableFormat.setCellSpacing(0); + + tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::PercentageLength, 20), + QTextLength(QTextLength::PercentageLength, 9), + QTextLength(QTextLength::PercentageLength, 9), + QTextLength(QTextLength::PercentageLength, 9), + QTextLength(QTextLength::PercentageLength, 9), + QTextLength(QTextLength::PercentageLength, 9), + QTextLength(QTextLength::PercentageLength, 9), + QTextLength(QTextLength::PercentageLength, 9), + QTextLength(QTextLength::PercentageLength, 9), + QTextLength(QTextLength::PercentageLength, 1), + QTextLength(QTextLength::PercentageLength, 3), + QTextLength(QTextLength::PercentageLength, 1), + QTextLength(QTextLength::PercentageLength, 3)}); + + QTextTable *table = cursor.insertTable(m_tests.size() * 2, 13, tableFormat); + + const char *emptyBox = "\u2610"; + //const char *checkBox = "\u2611"; + const char *checkBox = "x"; + + auto insertText = [&table](int row, int column, const QString &text) { + auto cell = table->cellAt(row, column); + auto textCursor = cell.firstCursorPosition(); + + auto blockFormat = textCursor.blockFormat(); + blockFormat.setAlignment(Qt::AlignCenter); + textCursor.setBlockFormat(blockFormat); + + auto cellFormat = cell.format(); + cellFormat.setVerticalAlignment(QTextCharFormat::AlignMiddle); + cell.setFormat(cellFormat); + + auto charFormat = textCursor.charFormat(); + charFormat.setVerticalAlignment(QTextCharFormat::AlignMiddle); + charFormat.setFontPointSize(8); + textCursor.setCharFormat(charFormat); + + textCursor.insertText(text); + }; + + int currentRow = 0; + for (const auto &test : m_tests) + { + table->mergeCells(currentRow, 0, 2, 1); + + int currentColumn = 0; + + insertText(currentRow, currentColumn, test.name()); + currentColumn++; + + for (const auto &item : test.items()) + { + insertText(currentRow, currentColumn, item.getText().c_str()); + insertText(currentRow + 1, currentColumn, item.isChecked() ? checkBox : emptyBox); + + currentColumn++; + } + + insertText(currentRow + 1, 12, QString::number(test.getPoints())); + + currentRow += 2; + } +} + +void CheckableTestModel::printSummaryTo(QTextCursor &cursor) const +{ + QTextTableFormat tableFormat; + tableFormat.setCellPadding(2); + tableFormat.setCellSpacing(0); + + tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::PercentageLength, 76), + QTextLength(QTextLength::PercentageLength, 20), + QTextLength(QTextLength::PercentageLength, 1), + QTextLength(QTextLength::PercentageLength, 3)}); + + QTextTable *table = cursor.insertTable(1, 4, tableFormat); + + auto insertText = [&table](int row, int column, const QString &text) { + auto cell = table->cellAt(row, column); + auto textCursor = cell.firstCursorPosition(); + + auto blockFormat = textCursor.blockFormat(); + blockFormat.setAlignment(Qt::AlignCenter); + textCursor.setBlockFormat(blockFormat); + + auto cellFormat = cell.format(); + cellFormat.setVerticalAlignment(QTextCharFormat::AlignMiddle); + cell.setFormat(cellFormat); + + auto charFormat = textCursor.charFormat(); + charFormat.setVerticalAlignment(QTextCharFormat::AlignMiddle); + charFormat.setFontPointSize(8); + textCursor.setCharFormat(charFormat); + + textCursor.insertText(text); + }; + + insertText(0, 1, "Rohwertpunkte Total:"); + insertText(0, 3, QString::number(getPoints())); +} + CheckableItems &CheckableTestModel::getItems(const QModelIndex &index) { if (index.row() < m_tests.size()) @@ -127,8 +249,7 @@ CheckableItems &CheckableTestModel::getItems(const QModelIndex &index) throw std::runtime_error("invalid index"); } -const CheckableItems &CheckableTestModel::getItems( - const QModelIndex &index) const +const CheckableItems &CheckableTestModel::getItems(const QModelIndex &index) const { if (index.row() < m_tests.size()) { @@ -162,7 +283,7 @@ const CheckableItem &CheckableTestModel::getItem(const QModelIndex &index) const unsigned int CheckableTestModel::getPoints() const { - unsigned int points = 0; + unsigned int points = 0; for (const auto &test : m_tests) { diff --git a/source/CheckableTestModel/CheckableTestModel.h b/source/CheckableTestModel/CheckableTestModel.h index 2fd5434..8f54220 100644 --- a/source/CheckableTestModel/CheckableTestModel.h +++ b/source/CheckableTestModel/CheckableTestModel.h @@ -2,6 +2,7 @@ #include "CheckableTest.h" #include +#include class CheckableTestModel : public QAbstractTableModel { @@ -27,9 +28,15 @@ public: unsigned int getPoints() const; + virtual void printTo(QTextCursor &cursor) const; + protected: virtual bool isValidIndex(const QModelIndex &index) const; + virtual std::string getName() const = 0; + void printTableTo(QTextCursor &cursor) const; + void printSummaryTo(QTextCursor &cursor) const; + private: CheckableItems &getItems(const QModelIndex &index); const CheckableItems &getItems(const QModelIndex &index) const; diff --git a/source/DataModel.cpp b/source/DataModel.cpp index 4ac4ffb..adebf86 100644 --- a/source/DataModel.cpp +++ b/source/DataModel.cpp @@ -63,22 +63,23 @@ void DataModel::read(std::istream &inStream) void DataModel::printTo(QTextCursor &cursor) const { QTextCharFormat titleFormat; - titleFormat.setFontPointSize(18); + titleFormat.setFontPointSize(14); cursor.insertText("ESGRAF 4-8 Auswertungsbogen", titleFormat); cursor.insertText("\n", titleFormat); m_metaData.printTo(cursor); - cursor.insertText("\n", titleFormat); - - m_v2Svk.printTo(cursor); - cursor.insertText("\n", titleFormat); + //m_v2Svk.printTo(cursor); m_verbEnd.printTo(cursor); - cursor.insertText("\n", titleFormat); + m_genus.printTo(cursor); + m_akkusativ.printTo(cursor); + m_dativ.printTo(cursor); + //m_plural.printTo(cursor); + //m_genitiv.printTo(cursor); + //m_passiv.printTo(cursor); //m_results.printTo(cursor); - //cursor.insertText("\n", titleFormat); } void DataModel::pluralModelChanged() diff --git a/source/MetaData/MetaDataModel.cpp b/source/MetaData/MetaDataModel.cpp index c6ef6dd..7f3769a 100644 --- a/source/MetaData/MetaDataModel.cpp +++ b/source/MetaData/MetaDataModel.cpp @@ -136,6 +136,7 @@ void MetaDataModel::printTo(QTextCursor &cursor) const cursor.insertBlock(); QTextTableFormat tableFormat; + tableFormat.setBorderStyle(QTextTableFormat::BorderStyle_None); tableFormat.setCellPadding(2); tableFormat.setCellSpacing(0); @@ -161,7 +162,10 @@ void MetaDataModel::printTo(QTextCursor &cursor) const cursor.movePosition(QTextCursor::NextCell); cursor.insertText(m_dateOfBirth.toString("dd.MM.yyyy")); cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Bemerkungen:"); + if (!m_remarks.trimmed().isEmpty()) + { + cursor.insertText("Bemerkungen:"); + } cursor.movePosition(QTextCursor::NextRow); cursor.insertText("Untersuchungsdatum"); @@ -175,6 +179,6 @@ void MetaDataModel::printTo(QTextCursor &cursor) const cursor.movePosition(QTextCursor::NextCell); cursor.insertText(getAge().toString().c_str()); - cursor.movePosition(QTextCursor::NextBlock); + cursor.movePosition(QTextCursor::End); } diff --git a/source/SubTests/AkkusativDativ/AkkusativModel.cpp b/source/SubTests/AkkusativDativ/AkkusativModel.cpp index 79d2c31..b481c50 100644 --- a/source/SubTests/AkkusativDativ/AkkusativModel.cpp +++ b/source/SubTests/AkkusativDativ/AkkusativModel.cpp @@ -105,3 +105,8 @@ void AkkusativModel::write(ESGRAF48::AkkusativModel &model) const futterModel->set_zucker(testItems[7].isChecked()); } } + +std::string AkkusativModel::getName() const +{ + return "Subtest 4: Akkusativ und Dativ"; +} diff --git a/source/SubTests/AkkusativDativ/AkkusativModel.h b/source/SubTests/AkkusativDativ/AkkusativModel.h index 43a4881..ae9d2f2 100644 --- a/source/SubTests/AkkusativDativ/AkkusativModel.h +++ b/source/SubTests/AkkusativDativ/AkkusativModel.h @@ -12,4 +12,7 @@ public: void read(const ESGRAF48::AkkusativModel &model); void write(ESGRAF48::AkkusativModel &model) const; + +protected: + std::string getName() const override; }; diff --git a/source/SubTests/AkkusativDativ/DativModel.cpp b/source/SubTests/AkkusativDativ/DativModel.cpp index 081dfdb..1948370 100644 --- a/source/SubTests/AkkusativDativ/DativModel.cpp +++ b/source/SubTests/AkkusativDativ/DativModel.cpp @@ -105,3 +105,8 @@ void DativModel::write(ESGRAF48::DativModel &model) const futterModel->set_zucker(testItems[7].isChecked()); } } + +std::string DativModel::getName() const +{ + return ""; +} diff --git a/source/SubTests/AkkusativDativ/DativModel.h b/source/SubTests/AkkusativDativ/DativModel.h index 6a9a323..97b7a59 100644 --- a/source/SubTests/AkkusativDativ/DativModel.h +++ b/source/SubTests/AkkusativDativ/DativModel.h @@ -12,4 +12,7 @@ public: void read(const ESGRAF48::DativModel &model); void write(ESGRAF48::DativModel &model) const; + +protected: + std::string getName() const override; }; diff --git a/source/SubTests/Genus/GenusModel.cpp b/source/SubTests/Genus/GenusModel.cpp index 3f2278b..b708ee7 100644 --- a/source/SubTests/Genus/GenusModel.cpp +++ b/source/SubTests/Genus/GenusModel.cpp @@ -95,3 +95,8 @@ void GenusModel::write(ESGRAF48::GenusModel &model) const zirkusModel->set_baum(testItems[3].isChecked()); } } + +std::string GenusModel::getName() const +{ + return "Subtest 3: Genus"; +} diff --git a/source/SubTests/Genus/GenusModel.h b/source/SubTests/Genus/GenusModel.h index 8261779..590873d 100644 --- a/source/SubTests/Genus/GenusModel.h +++ b/source/SubTests/Genus/GenusModel.h @@ -12,4 +12,7 @@ public: void read(const ESGRAF48::GenusModel &model); void write(ESGRAF48::GenusModel &model) const; + +protected: + std::string getName() const override; }; diff --git a/source/SubTests/LateSkills/GenitivModel.cpp b/source/SubTests/LateSkills/GenitivModel.cpp index 9ebf423..ee0b8a5 100644 --- a/source/SubTests/LateSkills/GenitivModel.cpp +++ b/source/SubTests/LateSkills/GenitivModel.cpp @@ -107,3 +107,8 @@ void GenitivModel::write(ESGRAF48::LateSkillsGenitivModel &model) const attributierungModel->set_guertel2(testItems[9].isChecked()); } } + +std::string GenitivModel::getName() const +{ + return ""; +} diff --git a/source/SubTests/LateSkills/GenitivModel.h b/source/SubTests/LateSkills/GenitivModel.h index 2346e94..1ba63c3 100644 --- a/source/SubTests/LateSkills/GenitivModel.h +++ b/source/SubTests/LateSkills/GenitivModel.h @@ -14,4 +14,7 @@ public: void read(const ESGRAF48::LateSkillsGenitivModel &model); void write(ESGRAF48::LateSkillsGenitivModel &model) const; + +protected: + std::string getName() const override; }; diff --git a/source/SubTests/LateSkills/PassivModel.cpp b/source/SubTests/LateSkills/PassivModel.cpp index 6f1d3a8..88399c6 100644 --- a/source/SubTests/LateSkills/PassivModel.cpp +++ b/source/SubTests/LateSkills/PassivModel.cpp @@ -65,3 +65,8 @@ void PassivModel::write(ESGRAF48::LateSkillsPassivModel &model) const model.set_fleisch1(testItems[8].isChecked()); model.set_fleisch2(testItems[9].isChecked()); } + +std::string PassivModel::getName() const +{ + return "Subtest 6: Späte Fähigkeiten (7;0 - 8;11)"; +} diff --git a/source/SubTests/LateSkills/PassivModel.h b/source/SubTests/LateSkills/PassivModel.h index e0671bb..90e93ca 100644 --- a/source/SubTests/LateSkills/PassivModel.h +++ b/source/SubTests/LateSkills/PassivModel.h @@ -14,4 +14,7 @@ public: void read(const ESGRAF48::LateSkillsPassivModel &model); void write(ESGRAF48::LateSkillsPassivModel &model) const; + +protected: + std::string getName() const override; }; diff --git a/source/SubTests/Plural/PluralModel.cpp b/source/SubTests/Plural/PluralModel.cpp index 0ade859..f7a5e2e 100644 --- a/source/SubTests/Plural/PluralModel.cpp +++ b/source/SubTests/Plural/PluralModel.cpp @@ -51,3 +51,8 @@ void PluralModel::write(ESGRAF48::PluralModel &model) const model.set_baer(testItems[7].isChecked()); model.set_apfel(testItems[8].isChecked()); } + +std::string PluralModel::getName() const +{ + return "Subtest 5: Plural"; +} diff --git a/source/SubTests/Plural/PluralModel.h b/source/SubTests/Plural/PluralModel.h index cadeae9..60d0ae8 100644 --- a/source/SubTests/Plural/PluralModel.h +++ b/source/SubTests/Plural/PluralModel.h @@ -15,4 +15,7 @@ public: void read(const ESGRAF48::PluralModel &model); void write(ESGRAF48::PluralModel &model) const; + +protected: + std::string getName() const override; }; diff --git a/source/SubTests/V2Svk/V2SvkModel.cpp b/source/SubTests/V2Svk/V2SvkModel.cpp index cdf7596..755eacd 100644 --- a/source/SubTests/V2Svk/V2SvkModel.cpp +++ b/source/SubTests/V2Svk/V2SvkModel.cpp @@ -200,22 +200,7 @@ void V2SvkModel::read(const ESGRAF48::V2SvkModel &model) emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1)); } -void V2SvkModel::printTo(QTextCursor &cursor) const +std::string V2SvkModel::getName() const { - cursor.insertBlock(); - - QTextCharFormat headerFormat; - headerFormat.setFontPointSize(12); - cursor.insertText( - "Subtest 1: Verbzweitstellungsregel (V2) und Subjekt-Verb-Kontrollregel (SVK)", - headerFormat); - - QTextTableFormat tableFormat; - tableFormat.setCellPadding(2); - tableFormat.setCellSpacing(0); - - QTextTable *table = cursor.insertTable(1, 1, tableFormat); - - cursor.movePosition(QTextCursor::NextBlock); + return "Subtest 1: Verbzweitstellungsregel (V2) und Subjekt-Verb-Kontrollregel (SVK)"; } - diff --git a/source/SubTests/V2Svk/V2SvkModel.h b/source/SubTests/V2Svk/V2SvkModel.h index 6b070d8..ec54a81 100644 --- a/source/SubTests/V2Svk/V2SvkModel.h +++ b/source/SubTests/V2Svk/V2SvkModel.h @@ -18,8 +18,8 @@ public: void write(ESGRAF48::V2SvkModel &model) const; void read(const ESGRAF48::V2SvkModel &model); - void printTo(QTextCursor &cursor) const; - protected: bool isValidIndex(const QModelIndex &index) const override; + + std::string getName() const override; }; diff --git a/source/SubTests/VerbEnd/VerbEndModel.cpp b/source/SubTests/VerbEnd/VerbEndModel.cpp index dce3e76..89d9a70 100644 --- a/source/SubTests/VerbEnd/VerbEndModel.cpp +++ b/source/SubTests/VerbEnd/VerbEndModel.cpp @@ -98,154 +98,7 @@ void VerbEndModel::read(const ESGRAF48::VerbEndModel &model) emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1)); } -void VerbEndModel::printTo(QTextCursor &cursor) const +std::string VerbEndModel::getName() const { - cursor.insertBlock(); - - QTextCharFormat headerFormat; - headerFormat.setFontPointSize(12); - cursor.insertText("Subtest 2: Verbendstellungsregel (VE)", headerFormat); - - QTextTableFormat tableFormat; - tableFormat.setCellPadding(2); - tableFormat.setCellSpacing(0); - - tableFormat.setColumnWidthConstraints({QTextLength(QTextLength::PercentageLength, 15), - QTextLength(QTextLength::PercentageLength, 9), - QTextLength(QTextLength::PercentageLength, 9), - QTextLength(QTextLength::PercentageLength, 9), - QTextLength(QTextLength::PercentageLength, 9), - QTextLength(QTextLength::PercentageLength, 9), - QTextLength(QTextLength::PercentageLength, 9), - QTextLength(QTextLength::PercentageLength, 9), - QTextLength(QTextLength::PercentageLength, 9), - QTextLength(QTextLength::PercentageLength, 2), - QTextLength(QTextLength::PercentageLength, 5), - QTextLength(QTextLength::PercentageLength, 1), - QTextLength(QTextLength::PercentageLength, 5)}); - - QTextTable *table = cursor.insertTable(6, 13, tableFormat); - table->mergeCells(0, 0, 2, 1); - table->mergeCells(2, 0, 2, 1); - table->mergeCells(4, 0, 2, 1); - - const char *emptyBox = "\u2610"; - //const char *checkBox = "\u2611"; - const char *checkBox = "x"; - - cursor.insertText("Telefonat"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Kausal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Kausal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Relativ"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Kausal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Final"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Temporal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Temporal"); - cursor.movePosition(QTextCursor::NextRow); - - const auto &telTestItems = m_tests.at(0).items(); - cursor.insertText(telTestItems[0].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(telTestItems[1].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(telTestItems[2].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(telTestItems[3].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(telTestItems[4].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(telTestItems[5].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(telTestItems[6].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(QString::number(m_tests.at(0).getPoints())); - cursor.movePosition(QTextCursor::NextRow); - - cursor.insertText("Zaubertrick"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Relativ"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Final"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Kausal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Final"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Temporal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Kausal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Temporal"); - cursor.movePosition(QTextCursor::NextRow); - - const auto &trickTestItems = m_tests.at(1).items(); - cursor.insertText(trickTestItems[0].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(trickTestItems[1].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(trickTestItems[2].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(trickTestItems[3].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(trickTestItems[4].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(trickTestItems[5].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(trickTestItems[6].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(QString::number(m_tests.at(1).getPoints())); - cursor.movePosition(QTextCursor::NextRow); - - cursor.insertText("Zauberregel"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Temporal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Kausal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Final"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Relativ"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Temporal"); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText("Relativ"); - cursor.movePosition(QTextCursor::NextRow); - - const auto ®elTestItems = m_tests.at(2).items(); - cursor.insertText(regelTestItems[0].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(regelTestItems[1].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(regelTestItems[2].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(regelTestItems[3].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(regelTestItems[4].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(regelTestItems[5].isChecked() ? checkBox : emptyBox); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.movePosition(QTextCursor::NextCell); - cursor.insertText(QString::number(m_tests.at(2).getPoints())); - - cursor.movePosition(QTextCursor::NextBlock); -} - + return "Subtest 2: Verbendstellungsregel (VE)"; +}; diff --git a/source/SubTests/VerbEnd/VerbEndModel.h b/source/SubTests/VerbEnd/VerbEndModel.h index e6a859c..10b4b1e 100644 --- a/source/SubTests/VerbEnd/VerbEndModel.h +++ b/source/SubTests/VerbEnd/VerbEndModel.h @@ -15,5 +15,6 @@ public: void write(ESGRAF48::VerbEndModel &model) const; void read(const ESGRAF48::VerbEndModel &model); - void printTo(QTextCursor &cursor) const; +protected: + std::string getName() const override; };