connected meta-data widget
This commit is contained in:
parent
c7c4104f1a
commit
64400a0e94
@ -1,6 +1,8 @@
|
|||||||
#include "DataModel.h"
|
#include "DataModel.h"
|
||||||
|
|
||||||
DataModel::DataModel(QObject *parent) : QObject(parent), m_metaData(this)
|
DataModel::DataModel(QObject *parent)
|
||||||
|
: QObject(parent)
|
||||||
|
, m_metaData(this)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,8 +1,14 @@
|
|||||||
#include "MetaDataWidget.h"
|
#include "MetaDataWidget.h"
|
||||||
#include "ui_MetaDataWidget.h"
|
#include "ui_MetaDataWidget.h"
|
||||||
|
|
||||||
|
#include "MetaDataModel.h"
|
||||||
|
|
||||||
|
#include <QDataWidgetMapper>
|
||||||
|
|
||||||
MetaDataWidget::MetaDataWidget(QWidget *parent)
|
MetaDataWidget::MetaDataWidget(QWidget *parent)
|
||||||
: QWidget(parent), ui(new Ui::MetaDataWidget)
|
: QWidget(parent)
|
||||||
|
, ui(new Ui::MetaDataWidget)
|
||||||
|
, m_widgetMapper(new QDataWidgetMapper(this))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
}
|
}
|
||||||
@ -12,3 +18,18 @@ MetaDataWidget::~MetaDataWidget()
|
|||||||
delete ui;
|
delete ui;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void MetaDataWidget::setModel(MetaDataModel *model)
|
||||||
|
{
|
||||||
|
m_widgetMapper->setModel(model);
|
||||||
|
m_widgetMapper->addMapping(ui->participantLineEdit, 0);
|
||||||
|
m_widgetMapper->addMapping(ui->instructorLineEdit, 1);
|
||||||
|
m_widgetMapper->addMapping(ui->dateOfBirthDateEdit, 2);
|
||||||
|
m_widgetMapper->addMapping(ui->dateOfTestDateEdit, 3);
|
||||||
|
m_widgetMapper->addMapping(ui->remarksPlainTextEdit, 4);
|
||||||
|
m_widgetMapper->toFirst();
|
||||||
|
}
|
||||||
|
|
||||||
|
void MetaDataWidget::toFirst()
|
||||||
|
{
|
||||||
|
m_widgetMapper->toFirst();
|
||||||
|
}
|
||||||
|
@ -2,8 +2,11 @@
|
|||||||
|
|
||||||
#include <QWidget>
|
#include <QWidget>
|
||||||
|
|
||||||
|
class QDataWidgetMapper;
|
||||||
|
class MetaDataModel;
|
||||||
|
|
||||||
namespace Ui {
|
namespace Ui {
|
||||||
class MetaDataWidget;
|
class MetaDataWidget;
|
||||||
};
|
};
|
||||||
|
|
||||||
class MetaDataWidget : public QWidget
|
class MetaDataWidget : public QWidget
|
||||||
@ -12,8 +15,12 @@ class MetaDataWidget : public QWidget
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
Ui::MetaDataWidget *ui;
|
Ui::MetaDataWidget *ui;
|
||||||
|
QDataWidgetMapper *m_widgetMapper;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MetaDataWidget(QWidget *parent = nullptr);
|
MetaDataWidget(QWidget *parent = nullptr);
|
||||||
~MetaDataWidget();
|
~MetaDataWidget();
|
||||||
|
|
||||||
|
void setModel(MetaDataModel *model);
|
||||||
|
void toFirst();
|
||||||
};
|
};
|
||||||
|
@ -11,25 +11,21 @@
|
|||||||
#include <QDataWidgetMapper>
|
#include <QDataWidgetMapper>
|
||||||
|
|
||||||
MainWindow::MainWindow(QWidget *parent)
|
MainWindow::MainWindow(QWidget *parent)
|
||||||
: QMainWindow(parent), ui(new Ui::MainWindow),
|
: QMainWindow(parent)
|
||||||
m_dataModel(new DataModel(parent))
|
, ui(new Ui::MainWindow)
|
||||||
, m_widgetMapper(new QDataWidgetMapper(parent))
|
, m_dataModel(new DataModel(parent))
|
||||||
{
|
{
|
||||||
ui->setupUi(this);
|
ui->setupUi(this);
|
||||||
|
|
||||||
ui->actionSave_as->setIcon(QIcon::fromTheme("document-save-as", QIcon("/usr/share/gtk-doc/html/gtk2/document-save-as.png")));
|
ui->actionSave_as->setIcon(QIcon::fromTheme("document-save-as",
|
||||||
ui->actionLoad->setIcon(QIcon::fromTheme("document-open", QIcon("/usr/share/gtk-doc/html/gtk2/document-open.png")));
|
QIcon("/usr/share/gtk-doc/html/gtk2/document-save-as.png")));
|
||||||
|
ui->actionLoad->setIcon(QIcon::fromTheme("document-open",
|
||||||
|
QIcon("/usr/share/gtk-doc/html/gtk2/document-open.png")));
|
||||||
|
|
||||||
connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs()));
|
connect(ui->actionSave_as, SIGNAL(triggered()), this, SLOT(saveAs()));
|
||||||
connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(load()));
|
connect(ui->actionLoad, SIGNAL(triggered()), this, SLOT(load()));
|
||||||
|
|
||||||
m_widgetMapper->setModel(&m_dataModel->m_metaData);
|
ui->metaDataWidget->setModel(&m_dataModel->m_metaData);
|
||||||
m_widgetMapper->addMapping(ui->lineEdit, 0);
|
|
||||||
m_widgetMapper->addMapping(ui->lineEdit_2, 1);
|
|
||||||
m_widgetMapper->addMapping(ui->dateEdit, 2);
|
|
||||||
m_widgetMapper->addMapping(ui->dateEdit_2, 3);
|
|
||||||
m_widgetMapper->addMapping(ui->plainTextEdit, 4);
|
|
||||||
m_widgetMapper->toFirst();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
MainWindow::~MainWindow()
|
MainWindow::~MainWindow()
|
||||||
@ -76,5 +72,5 @@ void MainWindow::load()
|
|||||||
|
|
||||||
m_dataModel->read(loadDoc.object());
|
m_dataModel->read(loadDoc.object());
|
||||||
|
|
||||||
m_widgetMapper->toFirst();
|
ui->metaDataWidget->toFirst();
|
||||||
}
|
}
|
||||||
|
@ -16,7 +16,6 @@ class MainWindow : public QMainWindow
|
|||||||
private:
|
private:
|
||||||
Ui::MainWindow *ui;
|
Ui::MainWindow *ui;
|
||||||
DataModel *m_dataModel;
|
DataModel *m_dataModel;
|
||||||
QDataWidgetMapper *m_widgetMapper;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
MainWindow(QWidget *parent = nullptr);
|
MainWindow(QWidget *parent = nullptr);
|
||||||
|
@ -15,62 +15,6 @@
|
|||||||
</property>
|
</property>
|
||||||
<widget class="QWidget" name="centralwidget">
|
<widget class="QWidget" name="centralwidget">
|
||||||
<layout class="QVBoxLayout" name="verticalLayout">
|
<layout class="QVBoxLayout" name="verticalLayout">
|
||||||
<item>
|
|
||||||
<widget class="QWidget" name="widget" native="true">
|
|
||||||
<layout class="QGridLayout" name="gridLayout">
|
|
||||||
<item row="2" column="0">
|
|
||||||
<widget class="QLabel" name="label_4">
|
|
||||||
<property name="text">
|
|
||||||
<string>Untersuchungsdatum</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="1">
|
|
||||||
<widget class="QLineEdit" name="lineEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="2">
|
|
||||||
<widget class="QLabel" name="label_3">
|
|
||||||
<property name="text">
|
|
||||||
<string>Geburtsdatum</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="0">
|
|
||||||
<widget class="QLabel" name="label">
|
|
||||||
<property name="text">
|
|
||||||
<string>Name, Vorname</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="3">
|
|
||||||
<widget class="QLineEdit" name="lineEdit_2"/>
|
|
||||||
</item>
|
|
||||||
<item row="1" column="2">
|
|
||||||
<widget class="QLabel" name="label_2">
|
|
||||||
<property name="text">
|
|
||||||
<string>Untersucher(in)</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="1">
|
|
||||||
<widget class="QDateEdit" name="dateEdit"/>
|
|
||||||
</item>
|
|
||||||
<item row="2" column="3">
|
|
||||||
<widget class="QDateEdit" name="dateEdit_2"/>
|
|
||||||
</item>
|
|
||||||
</layout>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QLabel" name="label_5">
|
|
||||||
<property name="text">
|
|
||||||
<string>Bemerkungen</string>
|
|
||||||
</property>
|
|
||||||
</widget>
|
|
||||||
</item>
|
|
||||||
<item>
|
|
||||||
<widget class="QPlainTextEdit" name="plainTextEdit"/>
|
|
||||||
</item>
|
|
||||||
<item>
|
<item>
|
||||||
<widget class="QTabWidget" name="tabWidget">
|
<widget class="QTabWidget" name="tabWidget">
|
||||||
<property name="currentIndex">
|
<property name="currentIndex">
|
||||||
|
Reference in New Issue
Block a user