From 8d5a30f79896859b7a9c187feb26476e89ca479e Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 31 Dec 2016 18:55:59 +0100 Subject: [PATCH] updated new attribute dialog, refs #9 --- source/annotator/source/attribute/attributeitem.cpp | 2 +- source/annotator/source/attribute/newattributedialog.cpp | 8 ++++++++ source/annotator/source/attribute/newattributedialog.h | 1 + source/annotator/source/object/objectwindow.cpp | 1 + 4 files changed, 11 insertions(+), 1 deletion(-) diff --git a/source/annotator/source/attribute/attributeitem.cpp b/source/annotator/source/attribute/attributeitem.cpp index 8a71a54..66460e7 100644 --- a/source/annotator/source/attribute/attributeitem.cpp +++ b/source/annotator/source/attribute/attributeitem.cpp @@ -24,6 +24,6 @@ void AttributeItem::reload() { AnnotatorLib::AttributeTypeToString(this->attribute->getType())); this->ui->typeComboBox->setCurrentText(type); QString defaultValue = - QString::fromStdString(this->attribute->getDefaultValue()->toString()); + QString::fromStdString(this->attribute->getValue()->toString()); this->ui->valueLineEdit->setText(defaultValue); } diff --git a/source/annotator/source/attribute/newattributedialog.cpp b/source/annotator/source/attribute/newattributedialog.cpp index 005bac3..a1a0ef3 100644 --- a/source/annotator/source/attribute/newattributedialog.cpp +++ b/source/annotator/source/attribute/newattributedialog.cpp @@ -1,7 +1,10 @@ // Copyright 2016 Annotator Team #include "newattributedialog.h" +#include "controller/commandcontroller.h" #include "ui_newattributedialog.h" +#include + NewAttributeDialog::NewAttributeDialog( std::shared_ptr session, shared_ptr object, QWidget *parent) @@ -22,4 +25,9 @@ void NewAttributeDialog::done(int status) { void NewAttributeDialog::createAttribute() { std::string name = ui->nameLineEdit->text().toStdString(); std::string type = ui->typeComboBox->currentText().toStdString(); + std::string value = ui->valueLineEdit->text().toStdString(); + shared_ptr nA; + nA = std::make_shared(session, object, type, name, value); + CommandController::instance()->execute(nA); } + diff --git a/source/annotator/source/attribute/newattributedialog.h b/source/annotator/source/attribute/newattributedialog.h index 0ecf103..18e4ceb 100644 --- a/source/annotator/source/attribute/newattributedialog.h +++ b/source/annotator/source/attribute/newattributedialog.h @@ -23,6 +23,7 @@ class NewAttributeDialog : public QDialog protected: void createAttribute(); + private: Ui::NewAttributeDialog *ui; void done(int status) override; diff --git a/source/annotator/source/object/objectwindow.cpp b/source/annotator/source/object/objectwindow.cpp index 1df1dff..3d96826 100644 --- a/source/annotator/source/object/objectwindow.cpp +++ b/source/annotator/source/object/objectwindow.cpp @@ -80,4 +80,5 @@ void ObjectWindow::on_addAttributeButton_clicked() { NewAttributeDialog dlg(session, object, this); dlg.exec(); + reloadAttributes(); }