added plural sub-test

This commit is contained in:
Michael Mandl 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 CheckableTestModel
MetaData MetaData
VerbEnd VerbEnd
Plural
Genus Genus
Qt5::Widgets Qt5::Widgets
) )

View file

@ -5,6 +5,7 @@ DataModel::DataModel(QObject *parent)
, m_metaData(this) , m_metaData(this)
, m_verbEnd(this) , m_verbEnd(this)
, m_genus(this) , m_genus(this)
, m_plural(this)
{ {
} }
@ -13,6 +14,7 @@ void DataModel::write(QJsonObject &target) const
write(m_metaData, target, "MetaData"); write(m_metaData, target, "MetaData");
write(m_verbEnd, target, "VerbEnd"); write(m_verbEnd, target, "VerbEnd");
write(m_genus, target, "Genus"); write(m_genus, target, "Genus");
write(m_plural, target, "Plural");
} }
void DataModel::read(const QJsonObject &source) void DataModel::read(const QJsonObject &source)
@ -20,4 +22,5 @@ void DataModel::read(const QJsonObject &source)
read(m_metaData, source, "MetaData"); read(m_metaData, source, "MetaData");
read(m_verbEnd, source, "VerbEnd"); read(m_verbEnd, source, "VerbEnd");
read(m_genus, source, "Genus"); read(m_genus, source, "Genus");
read(m_plural, source, "Plural");
} }

View file

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

View file

@ -2,3 +2,4 @@ cmake_minimum_required(VERSION 3.6)
add_subdirectory(VerbEnd) add_subdirectory(VerbEnd)
add_subdirectory(Genus) 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->metaDataWidget->setModel(&m_dataModel->m_metaData);
ui->verbEndWidget->setModel(&m_dataModel->m_verbEnd); ui->verbEndWidget->setModel(&m_dataModel->m_verbEnd);
ui->genusWidget->setModel(&m_dataModel->m_genus); ui->genusWidget->setModel(&m_dataModel->m_genus);
ui->pluralWidget->setModel(&m_dataModel->m_plural);
m_filename = ""; m_filename = "";
} }

View file

@ -18,7 +18,7 @@
<item> <item>
<widget class="QTabWidget" name="tabWidget"> <widget class="QTabWidget" name="tabWidget">
<property name="currentIndex"> <property name="currentIndex">
<number>2</number> <number>3</number>
</property> </property>
<widget class="QWidget" name="MetaDataTab"> <widget class="QWidget" name="MetaDataTab">
<attribute name="title"> <attribute name="title">
@ -50,6 +50,16 @@
</item> </item>
</layout> </layout>
</widget> </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> </widget>
</item> </item>
</layout> </layout>
@ -169,6 +179,12 @@
<header>VerbEndWidget.h</header> <header>VerbEndWidget.h</header>
<container>1</container> <container>1</container>
</customwidget> </customwidget>
<customwidget>
<class>PluralWidget</class>
<extends>QWidget</extends>
<header>PluralWidget.h</header>
<container>1</container>
</customwidget>
</customwidgets> </customwidgets>
<resources> <resources>
<include location="mainwindow.qrc"/> <include location="mainwindow.qrc"/>