Print subtests 2, 3 and 4
This commit is contained in:
parent
e2237110cf
commit
49b52f1dbc
21 changed files with 223 additions and 201 deletions
|
@ -3,6 +3,7 @@ cmake_minimum_required(VERSION 3.6)
|
||||||
project(CheckableTestModel LANGUAGES CXX)
|
project(CheckableTestModel LANGUAGES CXX)
|
||||||
|
|
||||||
find_package(Qt5Core REQUIRED)
|
find_package(Qt5Core REQUIRED)
|
||||||
|
find_package(Qt5Gui REQUIRED)
|
||||||
|
|
||||||
add_library(${PROJECT_NAME}
|
add_library(${PROJECT_NAME}
|
||||||
CheckableTestModel.cpp
|
CheckableTestModel.cpp
|
||||||
|
@ -22,4 +23,5 @@ target_link_libraries(${PROJECT_NAME}
|
||||||
CheckableItem
|
CheckableItem
|
||||||
CheckableTest
|
CheckableTest
|
||||||
Qt5::Core
|
Qt5::Core
|
||||||
|
Qt5::Gui
|
||||||
)
|
)
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include <QJsonArray>
|
#include <QJsonArray>
|
||||||
#include <QSize>
|
#include <QSize>
|
||||||
|
#include <QTextTable>
|
||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
|
|
||||||
CheckableTestModel::CheckableTestModel(QObject *parent)
|
CheckableTestModel::CheckableTestModel(QObject *parent)
|
||||||
|
@ -67,8 +68,7 @@ Qt::ItemFlags CheckableTestModel::flags(const QModelIndex &index) const
|
||||||
return Qt::NoItemFlags;
|
return Qt::NoItemFlags;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool CheckableTestModel::setData(
|
bool CheckableTestModel::setData(const QModelIndex &index, const QVariant &value, int role)
|
||||||
const QModelIndex &index, const QVariant &value, int role)
|
|
||||||
{
|
{
|
||||||
if (!isValidIndex(index))
|
if (!isValidIndex(index))
|
||||||
{
|
{
|
||||||
|
@ -93,8 +93,7 @@ bool CheckableTestModel::setData(
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
QVariant CheckableTestModel::headerData(
|
QVariant CheckableTestModel::headerData(int section, Qt::Orientation orientation, int role) const
|
||||||
int section, Qt::Orientation orientation, int role) const
|
|
||||||
{
|
{
|
||||||
if (role == Qt::DisplayRole && orientation == Qt::Vertical)
|
if (role == Qt::DisplayRole && orientation == Qt::Vertical)
|
||||||
{
|
{
|
||||||
|
@ -117,6 +116,129 @@ bool CheckableTestModel::isValidIndex(const QModelIndex &index) const
|
||||||
return false;
|
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)
|
CheckableItems &CheckableTestModel::getItems(const QModelIndex &index)
|
||||||
{
|
{
|
||||||
if (index.row() < m_tests.size())
|
if (index.row() < m_tests.size())
|
||||||
|
@ -127,8 +249,7 @@ CheckableItems &CheckableTestModel::getItems(const QModelIndex &index)
|
||||||
throw std::runtime_error("invalid index");
|
throw std::runtime_error("invalid index");
|
||||||
}
|
}
|
||||||
|
|
||||||
const CheckableItems &CheckableTestModel::getItems(
|
const CheckableItems &CheckableTestModel::getItems(const QModelIndex &index) const
|
||||||
const QModelIndex &index) const
|
|
||||||
{
|
{
|
||||||
if (index.row() < m_tests.size())
|
if (index.row() < m_tests.size())
|
||||||
{
|
{
|
||||||
|
|
|
@ -2,6 +2,7 @@
|
||||||
|
|
||||||
#include "CheckableTest.h"
|
#include "CheckableTest.h"
|
||||||
#include <QAbstractTableModel>
|
#include <QAbstractTableModel>
|
||||||
|
#include <QTextCursor>
|
||||||
|
|
||||||
class CheckableTestModel : public QAbstractTableModel
|
class CheckableTestModel : public QAbstractTableModel
|
||||||
{
|
{
|
||||||
|
@ -27,9 +28,15 @@ public:
|
||||||
|
|
||||||
unsigned int getPoints() const;
|
unsigned int getPoints() const;
|
||||||
|
|
||||||
|
virtual void printTo(QTextCursor &cursor) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
virtual bool isValidIndex(const QModelIndex &index) const;
|
virtual bool isValidIndex(const QModelIndex &index) const;
|
||||||
|
|
||||||
|
virtual std::string getName() const = 0;
|
||||||
|
void printTableTo(QTextCursor &cursor) const;
|
||||||
|
void printSummaryTo(QTextCursor &cursor) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
CheckableItems &getItems(const QModelIndex &index);
|
CheckableItems &getItems(const QModelIndex &index);
|
||||||
const CheckableItems &getItems(const QModelIndex &index) const;
|
const CheckableItems &getItems(const QModelIndex &index) const;
|
||||||
|
|
|
@ -63,22 +63,23 @@ void DataModel::read(std::istream &inStream)
|
||||||
void DataModel::printTo(QTextCursor &cursor) const
|
void DataModel::printTo(QTextCursor &cursor) const
|
||||||
{
|
{
|
||||||
QTextCharFormat titleFormat;
|
QTextCharFormat titleFormat;
|
||||||
titleFormat.setFontPointSize(18);
|
titleFormat.setFontPointSize(14);
|
||||||
|
|
||||||
cursor.insertText("ESGRAF 4-8 Auswertungsbogen", titleFormat);
|
cursor.insertText("ESGRAF 4-8 Auswertungsbogen", titleFormat);
|
||||||
cursor.insertText("\n", titleFormat);
|
cursor.insertText("\n", titleFormat);
|
||||||
|
|
||||||
m_metaData.printTo(cursor);
|
m_metaData.printTo(cursor);
|
||||||
cursor.insertText("\n", titleFormat);
|
|
||||||
|
|
||||||
m_v2Svk.printTo(cursor);
|
|
||||||
cursor.insertText("\n", titleFormat);
|
|
||||||
|
|
||||||
|
//m_v2Svk.printTo(cursor);
|
||||||
m_verbEnd.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);
|
//m_results.printTo(cursor);
|
||||||
//cursor.insertText("\n", titleFormat);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void DataModel::pluralModelChanged()
|
void DataModel::pluralModelChanged()
|
||||||
|
|
|
@ -136,6 +136,7 @@ void MetaDataModel::printTo(QTextCursor &cursor) const
|
||||||
cursor.insertBlock();
|
cursor.insertBlock();
|
||||||
|
|
||||||
QTextTableFormat tableFormat;
|
QTextTableFormat tableFormat;
|
||||||
|
tableFormat.setBorderStyle(QTextTableFormat::BorderStyle_None);
|
||||||
tableFormat.setCellPadding(2);
|
tableFormat.setCellPadding(2);
|
||||||
tableFormat.setCellSpacing(0);
|
tableFormat.setCellSpacing(0);
|
||||||
|
|
||||||
|
@ -161,7 +162,10 @@ void MetaDataModel::printTo(QTextCursor &cursor) const
|
||||||
cursor.movePosition(QTextCursor::NextCell);
|
cursor.movePosition(QTextCursor::NextCell);
|
||||||
cursor.insertText(m_dateOfBirth.toString("dd.MM.yyyy"));
|
cursor.insertText(m_dateOfBirth.toString("dd.MM.yyyy"));
|
||||||
cursor.movePosition(QTextCursor::NextCell);
|
cursor.movePosition(QTextCursor::NextCell);
|
||||||
|
if (!m_remarks.trimmed().isEmpty())
|
||||||
|
{
|
||||||
cursor.insertText("Bemerkungen:");
|
cursor.insertText("Bemerkungen:");
|
||||||
|
}
|
||||||
cursor.movePosition(QTextCursor::NextRow);
|
cursor.movePosition(QTextCursor::NextRow);
|
||||||
|
|
||||||
cursor.insertText("Untersuchungsdatum");
|
cursor.insertText("Untersuchungsdatum");
|
||||||
|
@ -175,6 +179,6 @@ void MetaDataModel::printTo(QTextCursor &cursor) const
|
||||||
cursor.movePosition(QTextCursor::NextCell);
|
cursor.movePosition(QTextCursor::NextCell);
|
||||||
cursor.insertText(getAge().toString().c_str());
|
cursor.insertText(getAge().toString().c_str());
|
||||||
|
|
||||||
cursor.movePosition(QTextCursor::NextBlock);
|
cursor.movePosition(QTextCursor::End);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,3 +105,8 @@ void AkkusativModel::write(ESGRAF48::AkkusativModel &model) const
|
||||||
futterModel->set_zucker(testItems[7].isChecked());
|
futterModel->set_zucker(testItems[7].isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string AkkusativModel::getName() const
|
||||||
|
{
|
||||||
|
return "Subtest 4: Akkusativ und Dativ";
|
||||||
|
}
|
||||||
|
|
|
@ -12,4 +12,7 @@ public:
|
||||||
|
|
||||||
void read(const ESGRAF48::AkkusativModel &model);
|
void read(const ESGRAF48::AkkusativModel &model);
|
||||||
void write(ESGRAF48::AkkusativModel &model) const;
|
void write(ESGRAF48::AkkusativModel &model) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::string getName() const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -105,3 +105,8 @@ void DativModel::write(ESGRAF48::DativModel &model) const
|
||||||
futterModel->set_zucker(testItems[7].isChecked());
|
futterModel->set_zucker(testItems[7].isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string DativModel::getName() const
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
|
@ -12,4 +12,7 @@ public:
|
||||||
|
|
||||||
void read(const ESGRAF48::DativModel &model);
|
void read(const ESGRAF48::DativModel &model);
|
||||||
void write(ESGRAF48::DativModel &model) const;
|
void write(ESGRAF48::DativModel &model) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::string getName() const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -95,3 +95,8 @@ void GenusModel::write(ESGRAF48::GenusModel &model) const
|
||||||
zirkusModel->set_baum(testItems[3].isChecked());
|
zirkusModel->set_baum(testItems[3].isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GenusModel::getName() const
|
||||||
|
{
|
||||||
|
return "Subtest 3: Genus";
|
||||||
|
}
|
||||||
|
|
|
@ -12,4 +12,7 @@ public:
|
||||||
|
|
||||||
void read(const ESGRAF48::GenusModel &model);
|
void read(const ESGRAF48::GenusModel &model);
|
||||||
void write(ESGRAF48::GenusModel &model) const;
|
void write(ESGRAF48::GenusModel &model) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::string getName() const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -107,3 +107,8 @@ void GenitivModel::write(ESGRAF48::LateSkillsGenitivModel &model) const
|
||||||
attributierungModel->set_guertel2(testItems[9].isChecked());
|
attributierungModel->set_guertel2(testItems[9].isChecked());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string GenitivModel::getName() const
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
|
|
@ -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:
|
||||||
|
std::string getName() const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -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());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string PassivModel::getName() const
|
||||||
|
{
|
||||||
|
return "Subtest 6: Späte Fähigkeiten (7;0 - 8;11)";
|
||||||
|
}
|
||||||
|
|
|
@ -14,4 +14,7 @@ public:
|
||||||
|
|
||||||
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:
|
||||||
|
std::string getName() const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -51,3 +51,8 @@ void PluralModel::write(ESGRAF48::PluralModel &model) const
|
||||||
model.set_baer(testItems[7].isChecked());
|
model.set_baer(testItems[7].isChecked());
|
||||||
model.set_apfel(testItems[8].isChecked());
|
model.set_apfel(testItems[8].isChecked());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string PluralModel::getName() const
|
||||||
|
{
|
||||||
|
return "Subtest 5: Plural";
|
||||||
|
}
|
||||||
|
|
|
@ -15,4 +15,7 @@ public:
|
||||||
|
|
||||||
void read(const ESGRAF48::PluralModel &model);
|
void read(const ESGRAF48::PluralModel &model);
|
||||||
void write(ESGRAF48::PluralModel &model) const;
|
void write(ESGRAF48::PluralModel &model) const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
std::string getName() const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -200,22 +200,7 @@ void V2SvkModel::read(const ESGRAF48::V2SvkModel &model)
|
||||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void V2SvkModel::printTo(QTextCursor &cursor) const
|
std::string V2SvkModel::getName() const
|
||||||
{
|
{
|
||||||
cursor.insertBlock();
|
return "Subtest 1: Verbzweitstellungsregel (V2) und Subjekt-Verb-Kontrollregel (SVK)";
|
||||||
|
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -18,8 +18,8 @@ public:
|
||||||
void write(ESGRAF48::V2SvkModel &model) const;
|
void write(ESGRAF48::V2SvkModel &model) const;
|
||||||
void read(const ESGRAF48::V2SvkModel &model);
|
void read(const ESGRAF48::V2SvkModel &model);
|
||||||
|
|
||||||
void printTo(QTextCursor &cursor) const;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
bool isValidIndex(const QModelIndex &index) const override;
|
bool isValidIndex(const QModelIndex &index) const override;
|
||||||
|
|
||||||
|
std::string getName() const override;
|
||||||
};
|
};
|
||||||
|
|
|
@ -98,154 +98,7 @@ void VerbEndModel::read(const ESGRAF48::VerbEndModel &model)
|
||||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||||
}
|
}
|
||||||
|
|
||||||
void VerbEndModel::printTo(QTextCursor &cursor) const
|
std::string VerbEndModel::getName() const
|
||||||
{
|
{
|
||||||
cursor.insertBlock();
|
return "Subtest 2: Verbendstellungsregel (VE)";
|
||||||
|
};
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -15,5 +15,6 @@ public:
|
||||||
void write(ESGRAF48::VerbEndModel &model) const;
|
void write(ESGRAF48::VerbEndModel &model) const;
|
||||||
void read(const ESGRAF48::VerbEndModel &model);
|
void read(const ESGRAF48::VerbEndModel &model);
|
||||||
|
|
||||||
void printTo(QTextCursor &cursor) const;
|
protected:
|
||||||
|
std::string getName() const override;
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue