Very basic subtest 2 print output
This commit is contained in:
parent
bcd0b17caa
commit
b06e717575
16 changed files with 272 additions and 130 deletions
|
@ -107,30 +107,6 @@ QVariant CheckableTestModel::headerData(
|
|||
return QAbstractTableModel::headerData(section, orientation, role);
|
||||
}
|
||||
|
||||
void CheckableTestModel::write(QJsonObject &json) const
|
||||
{
|
||||
for (const auto &test : m_tests)
|
||||
{
|
||||
QJsonArray testData;
|
||||
test.items().write(testData);
|
||||
json[test.name()] = testData;
|
||||
}
|
||||
}
|
||||
|
||||
void CheckableTestModel::read(const QJsonObject &json)
|
||||
{
|
||||
for (auto &test : m_tests)
|
||||
{
|
||||
auto testData = json[test.name()];
|
||||
if (testData.isArray())
|
||||
{
|
||||
test.items().read(testData.toArray());
|
||||
}
|
||||
}
|
||||
|
||||
emit dataChanged(index(0, 0), index(rowCount() - 1, columnCount() - 1));
|
||||
}
|
||||
|
||||
bool CheckableTestModel::isValidIndex(const QModelIndex &index) const
|
||||
{
|
||||
if (index.row() < m_tests.size())
|
||||
|
@ -190,10 +166,7 @@ unsigned int CheckableTestModel::getPoints() const
|
|||
|
||||
for (const auto &test : m_tests)
|
||||
{
|
||||
for (const auto &item : test.items())
|
||||
{
|
||||
points += item.points();
|
||||
}
|
||||
points += test.getPoints();
|
||||
}
|
||||
|
||||
return points;
|
||||
|
|
|
@ -25,9 +25,6 @@ public:
|
|||
QVariant headerData(int section, Qt::Orientation orientation,
|
||||
int role = Qt::DisplayRole) const override;
|
||||
|
||||
void write(QJsonObject &json) const;
|
||||
void read(const QJsonObject &json);
|
||||
|
||||
unsigned int getPoints() const;
|
||||
|
||||
protected:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue