From a2c4b16eb43615ae4a661c7fd528f0b56f8162f4 Mon Sep 17 00:00:00 2001 From: Michael Mandl Date: Sat, 17 Nov 2018 01:19:03 +0100 Subject: [PATCH] Made empty fields in V2Svk test uncheckable and uncountable, solves #3 --- source/CheckableTestModel/CheckableTestModel.h | 5 +++-- source/SubTests/V2Svk/V2SvkModel.cpp | 18 ++++++++++++++++++ source/SubTests/V2Svk/V2SvkModel.h | 3 +++ 3 files changed, 24 insertions(+), 2 deletions(-) diff --git a/source/CheckableTestModel/CheckableTestModel.h b/source/CheckableTestModel/CheckableTestModel.h index ee67c7b..7b4ed9d 100644 --- a/source/CheckableTestModel/CheckableTestModel.h +++ b/source/CheckableTestModel/CheckableTestModel.h @@ -30,9 +30,10 @@ public: unsigned int getPoints() const; -private: - bool isValidIndex(const QModelIndex &index) const; +protected: + virtual bool isValidIndex(const QModelIndex &index) const; +private: CheckableItems &getItems(const QModelIndex &index); const CheckableItems &getItems(const QModelIndex &index) const; diff --git a/source/SubTests/V2Svk/V2SvkModel.cpp b/source/SubTests/V2Svk/V2SvkModel.cpp index a78e5d1..6d7b373 100644 --- a/source/SubTests/V2Svk/V2SvkModel.cpp +++ b/source/SubTests/V2Svk/V2SvkModel.cpp @@ -69,6 +69,24 @@ unsigned int V2SvkModel::getSvkPoints() return points; } +bool V2SvkModel::isValidIndex(const QModelIndex &index) const +{ + switch (index.row()) + { + case 1: + return index.column() == 1 || index.column() == 7 || index.column() == 10; + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + return index.column() < 6; + default: + return CheckableTestModel::isValidIndex(index); + } +} + void V2SvkModel::writeProtoBuf(ESGRAF48::V2SvkModel &model) const { auto writeOneVal = [&](ESGRAF48::V2SvkModel::OneEach *modelData, int testIndex) { diff --git a/source/SubTests/V2Svk/V2SvkModel.h b/source/SubTests/V2Svk/V2SvkModel.h index 091e5b6..a574ac3 100644 --- a/source/SubTests/V2Svk/V2SvkModel.h +++ b/source/SubTests/V2Svk/V2SvkModel.h @@ -15,4 +15,7 @@ public: void writeProtoBuf(ESGRAF48::V2SvkModel &model) const; void readProtoBuf(const ESGRAF48::V2SvkModel &model); + +protected: + bool isValidIndex(const QModelIndex &index) const override; };