added RP and T-Wert rows to result display

This commit is contained in:
Michael Mandl 2018-06-08 20:32:19 +02:00
parent 077efaac32
commit bc7be14c65
3 changed files with 22 additions and 12 deletions

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>637</width> <width>637</width>
<height>269</height> <height>190</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">

View file

@ -11,7 +11,7 @@ ResultModel::ResultModel(QObject *parent)
int ResultModel::rowCount(const QModelIndex &parent) const int ResultModel::rowCount(const QModelIndex &parent) const
{ {
return 3; return 5;
} }
int ResultModel::columnCount(const QModelIndex &parent) const int ResultModel::columnCount(const QModelIndex &parent) const
@ -23,13 +23,19 @@ QVariant ResultModel::data(const QModelIndex &index, int role) const
{ {
if (role == Qt::DisplayRole) if (role == Qt::DisplayRole)
{ {
if (index.column() < m_results.size()) switch (index.row())
{ {
size_t points = m_results[index.column()].points(); case 0:
if (points != 0) if (index.column() < m_results.size())
{ {
return static_cast<uint>(points); size_t points = m_results[index.column()].points();
} if (points != 0)
{
return static_cast<uint>(points);
}
}
default:
break;
} }
return "-"; return "-";
@ -57,11 +63,15 @@ QVariant ResultModel::headerData(
switch (section) switch (section)
{ {
case 0: case 0:
return ">= PR 84"; return "RP";
case 1: case 1:
return "< PR 84"; return ">= PR 84";
case 2: case 2:
return "< PR 84";
case 3:
return "<= PR 16"; return "<= PR 16";
case 4:
return "T-Wert";
default: default:
return {}; return {};
} }
@ -80,6 +90,6 @@ void ResultModel::setPluralResult(size_t points)
if (m_results[8].points() != points) if (m_results[8].points() != points)
{ {
m_results[8] = points; m_results[8] = points;
emit dataChanged(index(0, 8), index(2, 8)); emit dataChanged(index(0, 8), index(4, 8));
} }
} }

View file

@ -7,7 +7,7 @@
<x>0</x> <x>0</x>
<y>0</y> <y>0</y>
<width>1125</width> <width>1125</width>
<height>572</height> <height>673</height>
</rect> </rect>
</property> </property>
<property name="windowTitle"> <property name="windowTitle">