implemented Akkusativ/Dativ result updates
This commit is contained in:
parent
3c2ac70a1c
commit
a951589787
@ -9,6 +9,8 @@ DataModel::DataModel(QObject *parent)
|
||||
, m_genus(this)
|
||||
, m_plural(this)
|
||||
, m_results(this)
|
||||
, m_akkusativ(this)
|
||||
, m_dativ(this)
|
||||
{
|
||||
connect(&m_plural, &PluralModel::dataChanged, this,
|
||||
&DataModel::pluralModelChanged);
|
||||
@ -18,6 +20,10 @@ DataModel::DataModel(QObject *parent)
|
||||
&DataModel::genusModelChanged);
|
||||
connect(&m_verbEnd, &VerbEndModel::dataChanged, this,
|
||||
&DataModel::verbEndModelChanged);
|
||||
connect(&m_akkusativ, &AkkusativModel::dataChanged, this,
|
||||
&DataModel::akkusativModelChanged);
|
||||
connect(&m_dativ, &DativModel::dataChanged, this,
|
||||
&DataModel::dativModelChanged);
|
||||
}
|
||||
|
||||
void DataModel::write(QJsonObject &target) const
|
||||
@ -26,6 +32,8 @@ void DataModel::write(QJsonObject &target) const
|
||||
write(m_verbEnd, target, "VerbEnd");
|
||||
write(m_genus, target, "Genus");
|
||||
write(m_plural, target, "Plural");
|
||||
write(m_akkusativ, target, "Akkusativ");
|
||||
write(m_dativ, target, "Dativ");
|
||||
}
|
||||
|
||||
void DataModel::read(const QJsonObject &source)
|
||||
@ -34,6 +42,8 @@ void DataModel::read(const QJsonObject &source)
|
||||
read(m_verbEnd, source, "VerbEnd");
|
||||
read(m_genus, source, "Genus");
|
||||
read(m_plural, source, "Plural");
|
||||
read(m_akkusativ, source, "Akkusativ");
|
||||
read(m_dativ, source, "Dativ");
|
||||
}
|
||||
|
||||
void DataModel::pluralModelChanged()
|
||||
@ -55,3 +65,13 @@ void DataModel::verbEndModelChanged()
|
||||
{
|
||||
m_results.setVerbEndResult(m_verbEnd.getPoints());
|
||||
}
|
||||
|
||||
void DataModel::akkusativModelChanged()
|
||||
{
|
||||
m_results.setAkkusativResult(m_akkusativ.getPoints());
|
||||
}
|
||||
|
||||
void DataModel::dativModelChanged()
|
||||
{
|
||||
m_results.setDativResult(m_dativ.getPoints());
|
||||
}
|
||||
|
@ -4,6 +4,8 @@
|
||||
#include "GenusModel.h"
|
||||
#include "VerbEndModel.h"
|
||||
#include "PluralModel.h"
|
||||
#include "AkkusativModel.h"
|
||||
#include "DativModel.h"
|
||||
|
||||
#include "ResultModel.h"
|
||||
|
||||
@ -18,6 +20,8 @@ public:
|
||||
VerbEndModel m_verbEnd;
|
||||
GenusModel m_genus;
|
||||
PluralModel m_plural;
|
||||
AkkusativModel m_akkusativ;
|
||||
DativModel m_dativ;
|
||||
|
||||
ResultModel m_results;
|
||||
|
||||
@ -53,4 +57,6 @@ private slots:
|
||||
void metaDataChanged();
|
||||
void genusModelChanged();
|
||||
void verbEndModelChanged();
|
||||
void akkusativModelChanged();
|
||||
void dativModelChanged();
|
||||
};
|
||||
|
@ -15,7 +15,7 @@ ResultModel::ResultModel(QObject *parent)
|
||||
|
||||
int ResultModel::rowCount(const QModelIndex &parent) const
|
||||
{
|
||||
return 5;
|
||||
return 4;
|
||||
}
|
||||
|
||||
int ResultModel::columnCount(const QModelIndex &parent) const
|
||||
@ -101,8 +101,6 @@ QVariant ResultModel::headerData(
|
||||
return "< PR 84";
|
||||
case 3:
|
||||
return "<= PR 16";
|
||||
case 4:
|
||||
return "T-Wert";
|
||||
default:
|
||||
return {};
|
||||
}
|
||||
@ -136,7 +134,7 @@ void ResultModel::setGenusResult(unsigned int points)
|
||||
emit dataChanged(index(0, 4), index(4, 4));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void ResultModel::setVerbEndResult(unsigned int points)
|
||||
{
|
||||
if (m_results[2].points() != points)
|
||||
@ -146,3 +144,21 @@ void ResultModel::setVerbEndResult(unsigned int points)
|
||||
emit dataChanged(index(0, 2), index(4, 2));
|
||||
}
|
||||
}
|
||||
|
||||
void ResultModel::setAkkusativResult(unsigned int points)
|
||||
{
|
||||
if (m_results[5].points() != points)
|
||||
{
|
||||
m_results[5].setPoints(points);
|
||||
emit dataChanged(index(0, 5), index(4, 5));
|
||||
}
|
||||
}
|
||||
|
||||
void ResultModel::setDativResult(unsigned int points)
|
||||
{
|
||||
if (m_results[6].points() != points)
|
||||
{
|
||||
m_results[6].setPoints(points);
|
||||
emit dataChanged(index(0, 6), index(4, 6));
|
||||
}
|
||||
}
|
||||
|
@ -66,4 +66,6 @@ public:
|
||||
void setPluralResult(unsigned int points);
|
||||
void setGenusResult(unsigned int points);
|
||||
void setVerbEndResult(unsigned int points);
|
||||
void setAkkusativResult(unsigned int points);
|
||||
void setDativResult(unsigned int points);
|
||||
};
|
||||
|
@ -4,10 +4,10 @@ VerbEndModel::VerbEndModel(QObject *parent)
|
||||
: CheckableTestModel(parent)
|
||||
{
|
||||
m_tests = { { "Telefonat",
|
||||
{ "Kausal (1)", "Kausal (2)", "Relativ", "Kausal (3)",
|
||||
"Final", "Temporal (1)", "Temporal (2)" } },
|
||||
{ "Zaubertrick", { "Relativ", "Final (1)", "Kausal (1)", "Final (2)",
|
||||
"Temporal (1)", "Kausal (2)", "Temporal (2)" } },
|
||||
{ "Zauberregel", { "Temporal (1)", "Kausal", "Final", "Relativ (1)",
|
||||
"Temporal (2)", "Relativ (2)" } } };
|
||||
{ "Kausal", "Kausal", "Relativ", "Kausal",
|
||||
"Final", "Temporal", "Temporal" } },
|
||||
{ "Zaubertrick", { "Relativ", "Final", "Kausal", "Final",
|
||||
"Temporal", "Kausal", "Temporal" } },
|
||||
{ "Zauberregel", { "Temporal", "Kausal", "Final", "Relativ",
|
||||
"Temporal", "Relativ" } } };
|
||||
}
|
||||
|
@ -35,6 +35,9 @@ void MainWindow::newFile()
|
||||
ui->verbEndWidget->setModel(&m_dataModel->m_verbEnd);
|
||||
ui->genusWidget->setModel(&m_dataModel->m_genus);
|
||||
ui->pluralWidget->setModel(&m_dataModel->m_plural);
|
||||
ui->akkusativDativWidget->setAkkusativModel(&m_dataModel->m_akkusativ);
|
||||
ui->akkusativDativWidget->setDativModel(&m_dataModel->m_dativ);
|
||||
|
||||
ui->resultWidget->setModel(&m_dataModel->m_results);
|
||||
|
||||
m_filename = "";
|
||||
|
@ -56,7 +56,7 @@
|
||||
</attribute>
|
||||
<layout class="QVBoxLayout" name="verticalLayout_7">
|
||||
<item>
|
||||
<widget class="AkkusativDativWidget" name="widget" native="true"/>
|
||||
<widget class="AkkusativDativWidget" name="akkusativDativWidget" native="true"/>
|
||||
</item>
|
||||
</layout>
|
||||
</widget>
|
||||
|
Reference in New Issue
Block a user