Skip to content

Commit

Permalink
updated new attribute dialog, refs #9
Browse files Browse the repository at this point in the history
  • Loading branch information
chriamue committed Dec 31, 2016
1 parent 8c9e72d commit 8d5a30f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion source/annotator/source/attribute/attributeitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
8 changes: 8 additions & 0 deletions source/annotator/source/attribute/newattributedialog.cpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
// Copyright 2016 Annotator Team
#include "newattributedialog.h"
#include "controller/commandcontroller.h"
#include "ui_newattributedialog.h"

#include <AnnotatorLib/Commands/NewAttribute.h>

NewAttributeDialog::NewAttributeDialog(
std::shared_ptr<AnnotatorLib::Session> session,
shared_ptr<AnnotatorLib::Object> object, QWidget *parent)
Expand All @@ -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<AnnotatorLib::Commands::NewAttribute> nA;
nA = std::make_shared<AnnotatorLib::Commands::NewAttribute>(session, object, type, name, value);
CommandController::instance()->execute(nA);
}

1 change: 1 addition & 0 deletions source/annotator/source/attribute/newattributedialog.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class NewAttributeDialog : public QDialog

protected:
void createAttribute();

private:
Ui::NewAttributeDialog *ui;
void done(int status) override;
Expand Down
1 change: 1 addition & 0 deletions source/annotator/source/object/objectwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,4 +80,5 @@ void ObjectWindow::on_addAttributeButton_clicked()
{
NewAttributeDialog dlg(session, object, this);
dlg.exec();
reloadAttributes();
}

0 comments on commit 8d5a30f

Please sign in to comment.