diff --git a/source/CMakeLists.txt b/source/CMakeLists.txt index 621084a..deb6337 100644 --- a/source/CMakeLists.txt +++ b/source/CMakeLists.txt @@ -40,6 +40,7 @@ target_link_libraries(${PROJECT_NAME} CheckableTestModel MetaData VerbEnd + Plural Genus Qt5::Widgets ) diff --git a/source/DataModel.cpp b/source/DataModel.cpp index 803b541..b53bc6d 100644 --- a/source/DataModel.cpp +++ b/source/DataModel.cpp @@ -5,6 +5,7 @@ DataModel::DataModel(QObject *parent) , m_metaData(this) , m_verbEnd(this) , m_genus(this) + , m_plural(this) { } @@ -13,6 +14,7 @@ void DataModel::write(QJsonObject &target) const write(m_metaData, target, "MetaData"); write(m_verbEnd, target, "VerbEnd"); write(m_genus, target, "Genus"); + write(m_plural, target, "Plural"); } void DataModel::read(const QJsonObject &source) @@ -20,4 +22,5 @@ void DataModel::read(const QJsonObject &source) read(m_metaData, source, "MetaData"); read(m_verbEnd, source, "VerbEnd"); read(m_genus, source, "Genus"); + read(m_plural, source, "Plural"); } diff --git a/source/DataModel.h b/source/DataModel.h index c8c38b0..5ec045b 100644 --- a/source/DataModel.h +++ b/source/DataModel.h @@ -3,6 +3,7 @@ #include "MetaData/MetaDataModel.h" #include "GenusModel.h" #include "VerbEndModel.h" +#include "PluralModel.h" #include @@ -14,6 +15,7 @@ public: MetaDataModel m_metaData; VerbEndModel m_verbEnd; GenusModel m_genus; + PluralModel m_plural; public: DataModel(QObject *parent); diff --git a/source/SubTests/CMakeLists.txt b/source/SubTests/CMakeLists.txt index 8b813b3..ad4883e 100644 --- a/source/SubTests/CMakeLists.txt +++ b/source/SubTests/CMakeLists.txt @@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.6) add_subdirectory(VerbEnd) add_subdirectory(Genus) +add_subdirectory(Plural) diff --git a/source/SubTests/Plural/CMakeLists.txt b/source/SubTests/Plural/CMakeLists.txt new file mode 100644 index 0000000..36245b1 --- /dev/null +++ b/source/SubTests/Plural/CMakeLists.txt @@ -0,0 +1,36 @@ +cmake_minimum_required(VERSION 3.6) + +project(Plural LANGUAGES CXX) + +find_package(Qt5Widgets REQUIRED) + +set(CMAKE_AUTOMOC ON) + +qt5_wrap_ui(UI_HEADERS + PluralWidget.ui +) + +add_library(${PROJECT_NAME} + PluralWidget.cpp + PluralModel.cpp + ${UI_HEADERS} +) + +set_target_properties(${PROJECT_NAME} + PROPERTIES CXX_STANDARD 14 +) + +target_include_directories(${PROJECT_NAME} + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} + PRIVATE + ${CMAKE_CURRENT_BINARY_DIR} +) + +target_link_libraries(${PROJECT_NAME} + PRIVATE + CheckableItem + CheckableTest + CheckableTestModel + Qt5::Widgets +) diff --git a/source/SubTests/Plural/PluralModel.cpp b/source/SubTests/Plural/PluralModel.cpp new file mode 100644 index 0000000..20af866 --- /dev/null +++ b/source/SubTests/Plural/PluralModel.cpp @@ -0,0 +1,9 @@ +#include "PluralModel.h" + +PluralModel::PluralModel(QObject *parent) + : CheckableTestModel(parent) +{ + m_tests = { { "", + { "Fisch /-e/", "Banane /-n/", "Bonbon /-s/", "Ei /-er/", "Eimer /-o/", + "Korn UML+/-er/", "Nuss UML+/-e/", "Bär /-en/", "Apfel UML" } } }; +} diff --git a/source/SubTests/Plural/PluralModel.h b/source/SubTests/Plural/PluralModel.h new file mode 100644 index 0000000..60427c0 --- /dev/null +++ b/source/SubTests/Plural/PluralModel.h @@ -0,0 +1,11 @@ +#pragma once + +#include "CheckableTestModel.h" + +class PluralModel : public CheckableTestModel +{ + Q_OBJECT + +public: + PluralModel(QObject *parent); +}; diff --git a/source/SubTests/Plural/PluralWidget.cpp b/source/SubTests/Plural/PluralWidget.cpp new file mode 100644 index 0000000..cf78939 --- /dev/null +++ b/source/SubTests/Plural/PluralWidget.cpp @@ -0,0 +1,23 @@ +#include "PluralWidget.h" +#include "ui_PluralWidget.h" + +#include "PluralModel.h" + +PluralWidget::PluralWidget(QWidget *parent) + : QWidget(parent) + , ui(new Ui::PluralWidget) +{ + ui->setupUi(this); + + ui->pluralTableView->horizontalHeader()->hide(); +} + +PluralWidget::~PluralWidget() +{ + delete ui; +} + +void PluralWidget::setModel(PluralModel *model) +{ + ui->pluralTableView->setModel(model); +} diff --git a/source/SubTests/Plural/PluralWidget.h b/source/SubTests/Plural/PluralWidget.h new file mode 100644 index 0000000..e4a3d41 --- /dev/null +++ b/source/SubTests/Plural/PluralWidget.h @@ -0,0 +1,23 @@ +#pragma once + +#include + +class PluralModel; + +namespace Ui { +class PluralWidget; +}; + +class PluralWidget : public QWidget +{ + Q_OBJECT + +private: + Ui::PluralWidget *ui; + +public: + PluralWidget(QWidget *parent = nullptr); + ~PluralWidget(); + + void setModel(PluralModel *model); +}; diff --git a/source/SubTests/Plural/PluralWidget.ui b/source/SubTests/Plural/PluralWidget.ui new file mode 100644 index 0000000..7e78ce4 --- /dev/null +++ b/source/SubTests/Plural/PluralWidget.ui @@ -0,0 +1,24 @@ + + + PluralWidget + + + + 0 + 0 + 556 + 210 + + + + Form + + + + + + + + + + diff --git a/source/mainwindow.cpp b/source/mainwindow.cpp index e6c2d84..24cee63 100644 --- a/source/mainwindow.cpp +++ b/source/mainwindow.cpp @@ -34,6 +34,7 @@ void MainWindow::newFile() ui->metaDataWidget->setModel(&m_dataModel->m_metaData); ui->verbEndWidget->setModel(&m_dataModel->m_verbEnd); ui->genusWidget->setModel(&m_dataModel->m_genus); + ui->pluralWidget->setModel(&m_dataModel->m_plural); m_filename = ""; } diff --git a/source/mainwindow.ui b/source/mainwindow.ui index 74f6462..81ef8de 100644 --- a/source/mainwindow.ui +++ b/source/mainwindow.ui @@ -18,7 +18,7 @@ - 2 + 3 @@ -50,6 +50,16 @@ + + + Subtest 5: Plural + + + + + + + @@ -169,6 +179,12 @@
VerbEndWidget.h
1 + + PluralWidget + QWidget +
PluralWidget.h
+ 1 +