Skip to content

Commit 8d5a30f

Browse files
committed
updated new attribute dialog, refs #9
1 parent 8c9e72d commit 8d5a30f

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

source/annotator/source/attribute/attributeitem.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,6 @@ void AttributeItem::reload() {
2424
AnnotatorLib::AttributeTypeToString(this->attribute->getType()));
2525
this->ui->typeComboBox->setCurrentText(type);
2626
QString defaultValue =
27-
QString::fromStdString(this->attribute->getDefaultValue()->toString());
27+
QString::fromStdString(this->attribute->getValue()->toString());
2828
this->ui->valueLineEdit->setText(defaultValue);
2929
}

source/annotator/source/attribute/newattributedialog.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
// Copyright 2016 Annotator Team
22
#include "newattributedialog.h"
3+
#include "controller/commandcontroller.h"
34
#include "ui_newattributedialog.h"
45

6+
#include <AnnotatorLib/Commands/NewAttribute.h>
7+
58
NewAttributeDialog::NewAttributeDialog(
69
std::shared_ptr<AnnotatorLib::Session> session,
710
shared_ptr<AnnotatorLib::Object> object, QWidget *parent)
@@ -22,4 +25,9 @@ void NewAttributeDialog::done(int status) {
2225
void NewAttributeDialog::createAttribute() {
2326
std::string name = ui->nameLineEdit->text().toStdString();
2427
std::string type = ui->typeComboBox->currentText().toStdString();
28+
std::string value = ui->valueLineEdit->text().toStdString();
29+
shared_ptr<AnnotatorLib::Commands::NewAttribute> nA;
30+
nA = std::make_shared<AnnotatorLib::Commands::NewAttribute>(session, object, type, name, value);
31+
CommandController::instance()->execute(nA);
2532
}
33+

source/annotator/source/attribute/newattributedialog.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ class NewAttributeDialog : public QDialog
2323

2424
protected:
2525
void createAttribute();
26+
2627
private:
2728
Ui::NewAttributeDialog *ui;
2829
void done(int status) override;

source/annotator/source/object/objectwindow.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,5 @@ void ObjectWindow::on_addAttributeButton_clicked()
8080
{
8181
NewAttributeDialog dlg(session, object, this);
8282
dlg.exec();
83+
reloadAttributes();
8384
}

0 commit comments

Comments
 (0)