added plural sub-test

pull/12/head
mandlm 2018-06-04 18:48:58 +02:00
parent 975c372baf
commit f7e0ae9c84
12 changed files with 151 additions and 1 deletions

View File

@ -40,6 +40,7 @@ target_link_libraries(${PROJECT_NAME}
CheckableTestModel
MetaData
VerbEnd
Plural
Genus
Qt5::Widgets
)

View File

@ -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");
}

View File

@ -3,6 +3,7 @@
#include "MetaData/MetaDataModel.h"
#include "GenusModel.h"
#include "VerbEndModel.h"
#include "PluralModel.h"
#include <QJsonObject>
@ -14,6 +15,7 @@ public:
MetaDataModel m_metaData;
VerbEndModel m_verbEnd;
GenusModel m_genus;
PluralModel m_plural;
public:
DataModel(QObject *parent);

View File

@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.6)
add_subdirectory(VerbEnd)
add_subdirectory(Genus)
add_subdirectory(Plural)

View File

@ -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
)

View File

@ -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" } } };
}

View File

@ -0,0 +1,11 @@
#pragma once
#include "CheckableTestModel.h"
class PluralModel : public CheckableTestModel
{
Q_OBJECT
public:
PluralModel(QObject *parent);
};

View File

@ -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);
}

View File

@ -0,0 +1,23 @@
#pragma once
#include <QWidget>
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);
};

View File

@ -0,0 +1,24 @@
<?xml version="1.0" encoding="UTF-8"?>
<ui version="4.0">
<class>PluralWidget</class>
<widget class="QWidget" name="PluralWidget">
<property name="geometry">
<rect>
<x>0</x>
<y>0</y>
<width>556</width>
<height>210</height>
</rect>
</property>
<property name="windowTitle">
<string>Form</string>
</property>
<layout class="QVBoxLayout" name="verticalLayout">
<item>
<widget class="QTableView" name="pluralTableView"/>
</item>
</layout>
</widget>
<resources/>
<connections/>
</ui>

View File

@ -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 = "";
}

View File

@ -18,7 +18,7 @@
<item>
<widget class="QTabWidget" name="tabWidget">
<property name="currentIndex">
<number>2</number>
<number>3</number>
</property>
<widget class="QWidget" name="MetaDataTab">
<attribute name="title">
@ -50,6 +50,16 @@
</item>
</layout>
</widget>
<widget class="QWidget" name="PluralTab">
<attribute name="title">
<string>Subtest 5: Plural</string>
</attribute>
<layout class="QVBoxLayout" name="verticalLayout_5">
<item>
<widget class="PluralWidget" name="pluralWidget" native="true"/>
</item>
</layout>
</widget>
</widget>
</item>
</layout>
@ -169,6 +179,12 @@
<header>VerbEndWidget.h</header>
<container>1</container>
</customwidget>
<customwidget>
<class>PluralWidget</class>
<extends>QWidget</extends>
<header>PluralWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets>
<resources>
<include location="mainwindow.qrc"/>